mirror of
https://github.com/wader/fq.git
synced 2024-12-29 16:42:06 +03:00
f4480c6fe5
interp: Refactor format help and also include options interp: Add -o name=@path to load file content as value (not documented yet, might change) interp,decode: Expose decode out value as _out (might change) interp: Refactor foramts.jq into format_{decode,func,include}.jq interp: Refactor torepr into _format_func for generic format function overloading interp: Refactor -o options parsing to be more generic and collect unknowns options to be used as format options decode of decode alises func for format overloaded functions include for format specific jq functions (also _help, torepr etc) flac_frame: Add bits_per_sample option mp3: Add max_unique_header_config and max_sync_seek options mp4: Add decode_samples and allow_truncate options avc_au: Has length_size option hevc_au: Has length_size option aac_frame: Has object_typee option doc: Rewrite format doc generation, less hack more jq
54 lines
924 B
Go
54 lines
924 B
Go
package decode
|
|
|
|
import "io/fs"
|
|
|
|
type Group []Format
|
|
|
|
type Dependency struct {
|
|
Names []string
|
|
Group *Group
|
|
}
|
|
|
|
type Format struct {
|
|
Name string
|
|
ProbeOrder int // probe order is from low to hi value then by name
|
|
Description string
|
|
Groups []string
|
|
DecodeFn func(d *D, in interface{}) interface{}
|
|
DecodeInArg interface{}
|
|
DecodeOutType interface{}
|
|
RootArray bool
|
|
RootName string
|
|
Dependencies []Dependency
|
|
Files fs.ReadDirFS
|
|
Help FormatHelp
|
|
Functions []string
|
|
}
|
|
|
|
type HelpExample struct {
|
|
Comment string
|
|
Code string
|
|
}
|
|
|
|
type HelpFunction struct {
|
|
Name string
|
|
Examples []HelpExample
|
|
}
|
|
|
|
type HelpReference struct {
|
|
Title string
|
|
URL string
|
|
}
|
|
|
|
type FormatHelp struct {
|
|
Notes string
|
|
Functions []HelpFunction
|
|
References []HelpReference
|
|
}
|
|
|
|
func FormatFn(d func(d *D, in interface{}) interface{}) Group {
|
|
return Group{{
|
|
DecodeFn: d,
|
|
}}
|
|
}
|