mirror of
https://github.com/wader/fq.git
synced 2024-11-29 23:27:12 +03:00
c93301fc70
raw format was a hack to skip decoding to be able to get a binary using tobyte etc. Now you can do fq -d bytes ... instead of fq -d raw 'tobytes | ...'
16 lines
594 B
Plaintext
16 lines
594 B
Plaintext
# note this is a "dynamic" include, output string will be used as source
|
|
|
|
# generates decode functions
|
|
# frommp3 and mp3 calls decode("mp3")
|
|
|
|
[ _registry as $r
|
|
| $r.groups
|
|
| to_entries[]
|
|
# TODO: nicer way to skip "all" which also would override builtin all/*
|
|
| select(.key != "all" and ($r.formats[.key].skip_decode_function | not))
|
|
| "def \(.key)($opts): decode(\(.key | tojson); $opts);"
|
|
, "def \(.key): decode(\(.key | tojson); {});"
|
|
, "def from\(.key)($opts): decode(\(.key | tojson); $opts) | if ._error then error(._error.error) end;"
|
|
, "def from\(.key): from\(.key)({});"
|
|
] | join("\n")
|