1
1
mirror of https://github.com/wader/fq.git synced 2024-12-26 15:02:28 +03:00
fq/pkg/interp/testdata/argvars.fqtest
Mattias Wadman ab8c728aaa interp: Rename --decode-file to --argdecode to be more consistent
There is still an alias for --decode-file
2022-07-04 12:28:37 +02:00

49 lines
1.3 KiB
Plaintext

/a.json:
aaa
/b.json:
bbb
$ fq -i -n --raw-file filea a.json --raw-file fileb b.json --arg arga aa --arg argb bb --argjson argjsona 123 --argjson argjsonb '[true,123,{},"abc"]' --argdecode argdecodea test.mp3 --argdecode argdecodeb test.mp3
null> $filea
"aaa\n"
null> $fileb
"bbb\n"
null> $arga
"aa"
null> $argb
"bb"
null> $argjsona
123
null> $argjsonb
[
true,
123,
{},
"abc"
]
null> $argdecodea | format
"mp3"
null> $argdecodeb | format
"mp3"
null> ^D
$ fq -n --raw-file filea nonexisting
exitcode: 2
stderr:
error: nonexisting: no such file or directory
$ fq -n --argdecode filea nonexisting
exitcode: 2
stderr:
error: --argdecode filea: no such file or directory
$ fq -n -d mp4 --argdecode filea test.mp3 '$filea'
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: test.mp3 (mp4)
| | | error: mp4: error at position 0x8: no styp, ftyp, free or moov box found
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| unknown0: raw bits
* |until 0x283.7 (end) (644) | |
$ fq -n --argjson a '(' '$a'
exitcode: 2
stderr:
error: --argjson a: invalid character '(' looking for beginning of value
$ fq -n --argjson a
exitcode: 2
stderr:
error: --argjson: needs two argument