mirror of
https://github.com/wader/fq.git
synced 2024-12-29 00:22:38 +03:00
Merge pull request #347 from wader/doc-update-demo-and-help
doc,interp: Update and add more examples
This commit is contained in:
commit
c1f7a80ac6
@ -17,6 +17,9 @@ echo
|
||||
c "Show ID3v2 tag inside mp3 file"
|
||||
s "fq '.headers[0]' file.mp3"
|
||||
echo
|
||||
c "Decode at two offsets as mp3_frame and show bitrate"
|
||||
s "fq -d raw 'tobytes[0xb79,0xc49:] | mp3_frame.header.bitrate' file.mp3"
|
||||
echo
|
||||
c "Extract PNG file"
|
||||
s "fq '.headers[].frames[] | select(.id == \"APIC\")?.picture | tobits' file.mp3 >file.png"
|
||||
s "file file.png"
|
||||
@ -24,5 +27,9 @@ rm -f file.png
|
||||
echo
|
||||
c "Resolution of embedded PNG cover art as YAML"
|
||||
s "fq -r '.headers[0].frames[] | grep_by(.id == \"APIC\") | grep_by(.type == \"IHDR\") | {res: {width, height}} | toyaml' file.mp3"
|
||||
#echo
|
||||
c "Add query parameter to URL"
|
||||
s "echo 'http://host?a=b' | fq -Rr 'fromurl | .query.b = 1234 | tourl'"
|
||||
s "echo 'http://host?a=b' | fq -Rr 'fromurl | .query.b = \"a b c\" | tourl'"
|
||||
echo
|
||||
c "Extract JSON and base64 encoded query parameter p"
|
||||
s "echo 'https://host?p=eyJhIjoiaGVsbG8ifQ%3D%3D' | fq -R 'fromurl.query.p | frombase64 | fromjson'"
|
||||
|
1302
doc/demo.svg
1302
doc/demo.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 78 KiB |
@ -93,13 +93,16 @@ def _help($arg0; $topic):
|
||||
, " fq . file"
|
||||
, " fq d file"
|
||||
, " fq tovalue file"
|
||||
, " fq -r totoml file.yml"
|
||||
, " fq -s -d html 'map(.html.head.title?)' *.html"
|
||||
, " cat file.cbor | fq -d cbor torepr"
|
||||
, " fq 'grep(\"^main$\") | parent' /bin/ls"
|
||||
, " fq 'grep_by(format == \"exif\") | d' *.png *.jpeg"
|
||||
, " fq -r 'grep_by(.protocol==\"icmp\").source_ip | tovalue' *.pcap"
|
||||
, " fq -i"
|
||||
)
|
||||
elif . == "banner" then
|
||||
( "fq - jq for binary formats"
|
||||
, "Tool, language and decoders for inspecting binary data."
|
||||
, "Tool, language and decoders for working with binary data."
|
||||
, "For more information see https://github.com/wader/fq"
|
||||
)
|
||||
elif . == "args" then
|
||||
|
7
pkg/interp/testdata/args.fqtest
vendored
7
pkg/interp/testdata/args.fqtest
vendored
@ -4,7 +4,7 @@ stderr:
|
||||
Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
|
||||
$ fq -h
|
||||
fq - jq for binary formats
|
||||
Tool, language and decoders for inspecting binary data.
|
||||
Tool, language and decoders for working with binary data.
|
||||
For more information see https://github.com/wader/fq
|
||||
|
||||
Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
|
||||
@ -13,9 +13,12 @@ Example usages:
|
||||
fq . file
|
||||
fq d file
|
||||
fq tovalue file
|
||||
fq -r totoml file.yml
|
||||
fq -s -d html 'map(.html.head.title?)' *.html
|
||||
cat file.cbor | fq -d cbor torepr
|
||||
fq 'grep("^main$") | parent' /bin/ls
|
||||
fq 'grep_by(format == "exif") | d' *.png *.jpeg
|
||||
fq -r 'grep_by(.protocol=="icmp").source_ip | tovalue' *.pcap
|
||||
fq -i
|
||||
|
||||
--arg NAME VALUE Set variable $NAME to string VALUE
|
||||
--argdecode NAME PATH Set variable $NAME to decode of PATH
|
||||
|
Loading…
Reference in New Issue
Block a user