1
1
mirror of https://github.com/wader/fq.git synced 2024-09-20 08:18:51 +03:00

Merge pull request #131 from wader/interp-tovalue-default-opts

interp: Add missing default opts for tovalue
This commit is contained in:
Mattias Wadman 2022-02-07 17:21:01 +01:00 committed by GitHub
commit 1d34cbd5e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -49,7 +49,7 @@ def decode: decode(options.decode_format; {});
def topath: _decode_value(._path);
def tovalue($opts): _tovalue(options($opts));
def tovalue: _tovalue({});
def tovalue: _tovalue(options({}));
def toactual: _decode_value(._actual);
def tosym: _decode_value(._sym);
def todescription: _decode_value(._description);

5
pkg/interp/testdata/tovalue.fqtest vendored Normal file
View File

@ -0,0 +1,5 @@
$ fq -i
null> "aaa" | raw | .unknown0 | tovalue, tovalue({sizebase: 2})
"<3>YWFh"
"<0b11>YWFh"
null> ^D

View File

@ -2,7 +2,7 @@ $ fq -i -d mp3 . /test.mp3
mp3> .headers[0].padding | ., tovalue, type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x20| 00 00 00 00 00 00 00 00 00 00 | .......... |.headers[0].padding: raw bits (all zero)
"<0b1010>AAAAAAAAAAAAAA=="
"<10>AAAAAAAAAAAAAA=="
"string"
10
mp3> .headers[0].padding[0] | ., type, length?