`
-
-By default truncate long strings when displaying decode value tree. Use `dd` or `d({string_truncate: 0})` to not truncate.
-
-
-## Color and unicode output
-
-fq by default tries to use colors if possible, this can be disabled with `-M`. You can also
-enable usage of unicode characters for improved output by setting the environment
-variable `CLIUNICODE`.
-
-## Configuration
-
-To add own functions you can use `init.jq` that will be read from
-- `$HOME/Library/Application Support/fq` or `$HOME/.config/fq` on macOS
-- `$HOME/.config/fq` on Linux, BSD etc
-- `%AppData%` on Windows
-
-## Use as script interpreter
-
-fq can be used as a script interpreter:
-
-`mp3_duration.jq`:
-```jq
-#!/usr/bin/env fq -d mp3 -rf
-[.frames[].header | .sample_count / .sample_rate] | add
-```
-
-## Decoded values
-
-When decoding something, using `decode` or `mp3` etc, you a decode value is returned. They behave like
-normal jq values but has special abilities and is used to represent the decoded structure. Each value
-always has a name, type and a bit range.
-
-A value has these special keys (TODO: remove, are internal)
-
-- `_actual` decoded (not symbol mapped value)
-- `_bits` bits in range as a binary
-- `_buffer_root` first decode value for current buffer
-- `_bytes` bits in range as binary using byte units
-- `_description` description of value (optional)
-- `_error` error message (optional)
-- `_format` name of decoded format (optional, only format root)
-- `_format_root` first decode value for current format
-- `_gap` is a bit range gap (was not decoded)
-- `_index` index in parent array (only for values in arrays)
-- `_len` bit range length (TODO: rename)
-- `_name` name of value
-- `_out` decoded out value
-- `_parent` parent decode value
-- `_path` jq path to decode value
-- `_root` root decode value
-- `_start` bit range start
-- `_stop` bit range stop
-- `_sym` symbolic value (optional)
-
-## Own decoders and use as library
-
-TODO
-
-## Known issues and useful tricks
-
-### Run interactive mode with no input
-```sh
-fq -i
-null>
-```
-
-### `select` fails with `expected an ... but got: ...`
-
-Try add `select(...)?` to catch and ignore type errors in the select expression.
-
-### Manual decode
-
-Sometimes fq fails to decode or you know there is valid data buried inside some binary or maybe
-you know the format of some gap field. Then you can decode manually.
-
-
-# try decode a `mp3_frame` that failed to decode
-$ fq -d mp3 '.gap0 | mp3_frame' file.mp3
-# skip first 10 bytes then decode as `mp3_frame`
-$ fq -d bytes '.[10:] | mp3_frame' file.mp3
-
-
-### Use `.` as input and in a positional argument
-
-The expression `.a | f(.b)` might not work as expected. `.` is `.a` when evaluating the arguments so
-the positional argument will end up being `.a.b`. Instead do `. as $c | .a | f($c.b)`.
-
-### Building array is slow
-
-Try to use `map` or `foreach` to avoid rebuilding the whole array for each append.
-
-### Use `print` and `println` to produce more friendly compact output
-
-```
-> [[0,"a"],[1,"b"]]
-[
- [
- 0,
- "a"
- ],
- [
- 1,
- "b"
- ]
-]
-> [[0,"a"],[1,"b"]] | .[] | "\(.[0]): \(.[1])" | println
-0: a
-1: b
-```
-
-### `repl` argument using function or variable causes `variable not defined`
-
-`true as $verbose | repl({verbose: $verbose})` will currently fail as `repl` is
-implemented by rewriting the query to `map(true as $verbose | .) | repl({verbose: $verbose})`.
-
-### `error` produces no output
-
-`null | error` behaves as `empty`.
diff --git a/format/apple/bookmark/apple_bookmark.md b/format/apple/bookmark/apple_bookmark.md
index 76aa4152a..44b52c346 100644
--- a/format/apple/bookmark/apple_bookmark.md
+++ b/format/apple/bookmark/apple_bookmark.md
@@ -2,7 +2,7 @@ Apple's `bookmarkData` format is used to encode information that can be resolved
into a `URL` object for a file even if the user moves or renames it. Can also
contain security scoping information for App Sandbox support.
-These `bookmarkData` blobs are often found endcoded in data fields of Binary
+These `bookmarkData` blobs are often found encoded in data fields of Binary
Property Lists. Notable examples include:
- `com.apple.finder.plist` - contains an `FXRecentFolders` value, which is an
diff --git a/format/apple/bookmark/testdata/help_applebookmark.fqtest b/format/apple/bookmark/testdata/help_applebookmark.fqtest
index 32fcc824e..adbebac96 100644
--- a/format/apple/bookmark/testdata/help_applebookmark.fqtest
+++ b/format/apple/bookmark/testdata/help_applebookmark.fqtest
@@ -12,7 +12,7 @@ Decode examples
Apple's bookmarkData format is used to encode information that can be resolved into a URL object for a file even if the user moves or
renames it. Can also contain security scoping information for App Sandbox support.
-These bookmarkData blobs are often found endcoded in data fields of Binary Property Lists. Notable examples include:
+These bookmarkData blobs are often found encoded in data fields of Binary Property Lists. Notable examples include:
- com.apple.finder.plist - contains an FXRecentFolders value, which is an array of ten objects, each of which consists of a name and
file-bookmark field, which is a bookmarkData object for each recently accessed folder location.
diff --git a/format/apple/bplist/bplist.md b/format/apple/bplist/bplist.md
index bfdf9c36b..31f881a7a 100644
--- a/format/apple/bplist/bplist.md
+++ b/format/apple/bplist/bplist.md
@@ -7,8 +7,8 @@ $ fq d Info.plist
Timestamps in Apple Binary Property Lists are encoded as Cocoa Core Data
timestamps, where the raw value is the floating point number of seconds since
January 1, 2001. By default, `fq` will render the raw floating point value. In
-order to get the raw value or string description, use the `todescription`
-function, you can use the `tovalue` and `todescription` functions:
+order to get the raw value or the string description, use the `tovalue` or
+`todescription` functions:
```sh
$ fq 'torepr.SomeTimeStamp | tovalue' Info.plist
diff --git a/format/asn1/asn1_ber.md b/format/asn1/asn1_ber.md
index 5a49f3066..ce4506ecc 100644
--- a/format/asn1/asn1_ber.md
+++ b/format/asn1/asn1_ber.md
@@ -19,7 +19,7 @@ $ fq -d asn1_ber '.constructed[1].value | asn1_ber' file.ber
### Manual schema
```sh
-$ fq -d asn1_ber 'torepr as $r | ["version", "modulus", "private_exponent", "private_exponen", "prime1", "prime2", "exponent1", "exponent2", "coefficient"] | with_entries({key: .value, value: $r[.key]})' pkcs1.der
+$ fq -d asn1_ber 'torepr as $r | ["version", "modulus", "private_exponent", "prime1", "prime2", "exponent1", "exponent2", "coefficient"] | with_entries({key: .value, value: $r[.key]})' pkcs1.der
```
### References
diff --git a/format/asn1/testdata/help_asn1_ber.fqtest b/format/asn1/testdata/help_asn1_ber.fqtest
index c12c0882d..09e6d54d8 100644
--- a/format/asn1/testdata/help_asn1_ber.fqtest
+++ b/format/asn1/testdata/help_asn1_ber.fqtest
@@ -25,7 +25,7 @@ Can decode nested values
Manual schema
=============
- $ fq -d asn1_ber 'torepr as $r | ["version", "modulus", "private_exponent", "private_exponen", "prime1", "prime2", "exponent1", "exponent2", "coefficient"] | with_entries({key: .value, value: $r[.key]})' pkcs1.der
+ $ fq -d asn1_ber 'torepr as $r | ["version", "modulus", "private_exponent", "prime1", "prime2", "exponent1", "exponent2", "coefficient"] | with_entries({key: .value, value: $r[.key]})' pkcs1.der
References
==========
diff --git a/format/bits/bits.md b/format/bits/bits.md
index f682f583d..b037305fd 100644
--- a/format/bits/bits.md
+++ b/format/bits/bits.md
@@ -12,7 +12,7 @@ $ echo 'some {"a":1} json' | fq -d bits '.[40:-48] | fromjson'
## Index bits
```sh
-✗ echo 'hello' | fq -d bits '.[4]'
+$ echo 'hello' | fq -d bits '.[4]'
1
$ echo 'hello' | fq -c -d bits '[.[range(8)]]'
[0,1,1,0,1,0,0,0]
diff --git a/format/fit/fit.md b/format/fit/fit.md
index 136ecd069..5ef7ed9f0 100644
--- a/format/fit/fit.md
+++ b/format/fit/fit.md
@@ -2,7 +2,7 @@
- Fields with subcomponents, such as "compressed_speed_distance" field on globalMessageNumber 20 is not represented correctly.
The field is read as 3 separate bytes where the first 12 bits are speed and the last 12 bits are distance.
-- There are still lots of UNKOWN fields due to gaps in Garmins SDK Profile documentation. (Currently FIT SDK 21.126)
+- There are still lots of UNKNOWN fields due to gaps in Garmin's SDK Profile documentation. (Currently FIT SDK 21.126)
- Compressed timestamp messages are not accumulated against last known full timestamp.
### Convert stream of data messages to JSON array
diff --git a/format/format.go b/format/format.go
index 1b077e299..a38e5c225 100644
--- a/format/format.go
+++ b/format/format.go
@@ -452,11 +452,11 @@ type TLS_In struct {
}
type Pg_Control_In struct {
- Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14.., postgres10"`
+ Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14, postgres10"`
}
type Pg_Heap_In struct {
- Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14.., postgres10"`
+ Flavour string `doc:"PostgreSQL flavour: postgres14, pgproee14, postgres10"`
Page int `doc:"First page number in file, default is 0"`
Segment int `doc:"Segment file number (16790.1 is 1), default is 0"`
}
diff --git a/format/isobmff/mp4.md b/format/isobmff/mp4.md
index 0181ce3a7..5b8058e24 100644
--- a/format/isobmff/mp4.md
+++ b/format/isobmff/mp4.md
@@ -1,7 +1,7 @@
### Speed up decoding by not decoding samples
```sh
-# manually decode first sample as a aac_frame
+# manually decode first sample as an aac_frame
$ fq -o decode_samples=false '.tracks[0].samples[0] | aac_frame | d' file.mp4
```
@@ -23,14 +23,14 @@ $ fq 'del(.tracks) | grep_by(.type=="mdat").data = "" | tovalue' file.
$ fq -n '"AAAAHGVsc3QAAAAAAAAAAQAAADIAAAQAAAEAAA==" | from_base64 | mp4({force:true}) | d'
```
-### Lookup mp4 box using a mp4 box path.
+### Lookup mp4 box using an mp4 box path
```sh
# | mp4_path($path) ->
$ fq 'mp4_path(".moov.trak[1]")' file.mp4
```
-### Get mp4 box path for a decode value box.
+### Get mp4 box path for a decode value box
```sh
# | mp4_path -> string
diff --git a/format/isobmff/testdata/help_mp4.fqtest b/format/isobmff/testdata/help_mp4.fqtest
index cc9b1f72d..dcd2e0789 100644
--- a/format/isobmff/testdata/help_mp4.fqtest
+++ b/format/isobmff/testdata/help_mp4.fqtest
@@ -22,7 +22,7 @@ Decode examples
Speed up decoding by not decoding samples
=========================================
- # manually decode first sample as a aac_frame
+ # manually decode first sample as an aac_frame
$ fq -o decode_samples=false '.tracks[0].samples[0] | aac_frame | d' file.mp4
Entries for first edit list as values
@@ -37,13 +37,13 @@ Force decode a single box
=========================
$ fq -n '"AAAAHGVsc3QAAAAAAAAAAQAAADIAAAQAAAEAAA==" | from_base64 | mp4({force:true}) | d'
-Lookup mp4 box using a mp4 box path.
+Lookup mp4 box using an mp4 box path
====================================
# | mp4_path($path) ->
$ fq 'mp4_path(".moov.trak[1]")' file.mp4
-Get mp4 box path for a decode value box.
-========================================
+Get mp4 box path for a decode value box
+=======================================
# | mp4_path -> string
$ fq 'grep_by(.type == "trak") | mp4_path' file.mp4
diff --git a/format/markdown/markdown.jq b/format/markdown/markdown.jq
index 2b8ec8535..a18ccd5e5 100644
--- a/format/markdown/markdown.jq
+++ b/format/markdown/markdown.jq
@@ -92,3 +92,42 @@ def _markdown_to_text($width; $header_depth):
][:-1] | join("\n");
def _markdown_to_text:
_markdown_to_text(-1; 0);
+
+def _markdown_to_asciidoc:
+ def _f:
+ def _collect:
+ ( [.children[] | _f]
+ | join("")
+ );
+ if type == "string" then gsub("\n"; " ")
+ elif .type == "document" then .children[] | _f
+ elif .type == "heading" then
+ ( (.children | map(_markdown_children_to_text(0)) | join(" ")) as $h
+ | ""
+ , $h + ":::"
+ , ""
+ )
+ elif .type == "paragraph" then _collect
+ elif .type | . == "em" or . == "strong" then "_" + _collect + "_"
+ elif .type == "link" then
+ ( _collect as $text
+ | if $text == .destination then $text
+ else "\(.destination)[\($text)]"
+ end
+ )
+ elif .type == "code_block" then
+ ( .literal
+ | rtrimstr("\n")
+ | "[source,console]"
+ , "----"
+ , .
+ , "----"
+ )
+ elif .type == "code" then "`" + .literal + "`"
+ elif .type == "list" then "", ([.children[] | _f] | join("\n")), "", "//-" # TODO: delim
+ elif .type == "list_item" then "\(.bullet_char) \(.children[] | _f)"
+ elif .type == "html_span" then .literal | gsub("
"; "\n") # TODO: more?
+ else empty
+ end;
+ [_f] | join("\n");
+
diff --git a/format/matroska/matroska.md b/format/matroska/matroska.md
index e533de5d1..aef0fdd0a 100644
--- a/format/matroska/matroska.md
+++ b/format/matroska/matroska.md
@@ -1,7 +1,7 @@
### Lookup element using path
```sh
-$ fq 'matroska_path(".Segment.Tracks[0)")' file.mkv
+$ fq 'matroska_path(".Segment.Tracks[0]")' file.mkv
```
### Get path to element
diff --git a/format/matroska/testdata/help_matroska.fqtest b/format/matroska/testdata/help_matroska.fqtest
index 550ab65e8..a0868cc55 100644
--- a/format/matroska/testdata/help_matroska.fqtest
+++ b/format/matroska/testdata/help_matroska.fqtest
@@ -20,7 +20,7 @@ Decode examples
Lookup element using path
=========================
- $ fq 'matroska_path(".Segment.Tracks[0)")' file.mkv
+ $ fq 'matroska_path(".Segment.Tracks[0]")' file.mkv
Get path to element
===================
diff --git a/format/midi/midi.md b/format/midi/midi.md
index 58031a90b..62ffe76ef 100644
--- a/format/midi/midi.md
+++ b/format/midi/midi.md
@@ -8,7 +8,7 @@
1. Extract the track names from a MIDI file
```
-fq -d midi -d midi '.. | select(.event=="track_name")? | "\(.track_name)"' midi/twinkle.mid
+fq -d midi '.. | select(.event=="track_name")? | "\(.track_name)"' midi/twinkle.mid
```
2. Extract the tempo changes from a MIDI file
diff --git a/format/midi/testdata/help_midi.fqtest b/format/midi/testdata/help_midi.fqtest
index 319b3f700..1a616540c 100644
--- a/format/midi/testdata/help_midi.fqtest
+++ b/format/midi/testdata/help_midi.fqtest
@@ -19,7 +19,7 @@ Sample queries
==============
* Extract the track names from a MIDI file
- fq -d midi -d midi '.. | select(.event=="track_name")? | "\(.track_name)"' midi/twinkle.mid
+ fq -d midi '.. | select(.event=="track_name")? | "\(.track_name)"' midi/twinkle.mid
* Extract the tempo changes from a MIDI file
diff --git a/format/riff/avi.md b/format/riff/avi.md
index 395cddb3b..4d90e6cd8 100644
--- a/format/riff/avi.md
+++ b/format/riff/avi.md
@@ -15,7 +15,7 @@ $ fq -o decode_samples=false '[.chunks[0] | grep_by(.id=="LIST" and .type=="strl
### Speed up decoding by disabling sample and extended chunks decoding
-If your not interested in sample details or extended chunks you can speed up decoding by using:
+If you're not interested in sample details or extended chunks you can speed up decoding by using:
```sh
$ fq -o decode_samples=false -o decode_extended_chunks=false d file.avi
```
diff --git a/format/riff/testdata/help_avi.fqtest b/format/riff/testdata/help_avi.fqtest
index 2f0bc3b82..d8aec01c8 100644
--- a/format/riff/testdata/help_avi.fqtest
+++ b/format/riff/testdata/help_avi.fqtest
@@ -34,7 +34,7 @@ Show stream summary
Speed up decoding by disabling sample and extended chunks decoding
==================================================================
-If your not interested in sample details or extended chunks you can speed up decoding by using:
+If you're not interested in sample details or extended chunks you can speed up decoding by using:
$ fq -o decode_samples=false -o decode_extended_chunks=false d file.avi
diff --git a/format/rtmp/rtmp.md b/format/rtmp/rtmp.md
index 3478c7066..675f33bed 100644
--- a/format/rtmp/rtmp.md
+++ b/format/rtmp/rtmp.md
@@ -1,4 +1,4 @@
-Current only supports plain RTMP (not RTMPT or encrypted variants etc) with AMF0 (not AMF3).
+Currently only supports plain RTMP (not RTMPT or encrypted variants etc) with AMF0 (not AMF3).
### Show rtmp streams in PCAP file
```sh
diff --git a/format/rtmp/testdata/help_rtmp.fqtest b/format/rtmp/testdata/help_rtmp.fqtest
index 5afb3486e..84cda9b67 100644
--- a/format/rtmp/testdata/help_rtmp.fqtest
+++ b/format/rtmp/testdata/help_rtmp.fqtest
@@ -9,7 +9,7 @@ Decode examples
# Decode value as rtmp
... | rtmp
-Current only supports plain RTMP (not RTMPT or encrypted variants etc) with AMF0 (not AMF3).
+Currently only supports plain RTMP (not RTMPT or encrypted variants etc) with AMF0 (not AMF3).
Show rtmp streams in PCAP file
==============================
diff --git a/format/tls/testdata/help_tls.fqtest b/format/tls/testdata/help_tls.fqtest
index f2b73c0c7..459f8fa93 100644
--- a/format/tls/testdata/help_tls.fqtest
+++ b/format/tls/testdata/help_tls.fqtest
@@ -18,16 +18,16 @@ Decode examples
# Decode value as tls
... | tls({keylog:""})
-Supports decoding of most standard records, messages and extensions. Can also decrypt most standard cipher suits in a PCAP with
+Supports decoding of most standard records, messages and extensions. Can also decrypt most standard cipher suites in a PCAP with
traffic in both directions if a NSS key log is provided.
-Decode and decrypt provding a PCAP and key log
-==============================================
+Decode and decrypt providing a PCAP and key log
+===============================================
Write traffic to a PCAP file:
$ tcpdump -i -w traffic.pcap
-Make sure your curl TLS backend support SSLKEYLOGFILE and do:
+Make sure your curl TLS backend supports SSLKEYLOGFILE and do:
$ SSLKEYLOGFILE=traffic.keylog curl --tls-max 1.2 https://host/path
@@ -59,24 +59,19 @@ TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
-TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
-TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
-TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384eadAESGCM,
+TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
+TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
-TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA, TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,
-TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
-TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
-TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
-TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
-TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_PSK_WITH_AES_128_CBC_SHA,
-TLS_PSK_WITH_AES_256_CBC_SHA, TLS_PSK_WITH_RC4_128_SHA, TLS_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_RSA_EXPORT_WITH_RC4_40_MD5,
-TLS_RSA_WITH_3DES_EDE_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA,
-TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256,
-TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384,
-TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_RC4_128_MD5, TLS_RSA_WITH_RC4_128_SHA,
-TLS_RSA_WITH_RC4_128_SHA
+TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA, TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256, TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA,
+TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
+TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
+TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
+TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_PSK_WITH_AES_128_CBC_SHA, TLS_PSK_WITH_AES_256_CBC_SHA, TLS_PSK_WITH_RC4_128_SHA,
+TLS_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_RSA_EXPORT_WITH_RC4_40_MD5, TLS_RSA_WITH_3DES_EDE_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA,
+TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA256,
+TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_RC4_128_MD5, TLS_RSA_WITH_RC4_128_SHA
References
==========
- RFC 5246: The Transport Layer Security (TLS) Protocol (https://www.rfc-editor.org/rfc/rfc5246)
-- RFC 6101: The Secure Sockets Layer (SSL) Protocol Version 3.0 (https://www.rfc-editor.org/rfc/rfc)
+- RFC 6101: The Secure Sockets Layer (SSL) Protocol Version 3.0 (https://www.rfc-editor.org/rfc/rfc6101)
diff --git a/format/tls/tls.md b/format/tls/tls.md
index 8b9521b5c..2ba37c3c5 100644
--- a/format/tls/tls.md
+++ b/format/tls/tls.md
@@ -1,6 +1,6 @@
-Supports decoding of most standard records, messages and extensions. Can also decrypt most standard cipher suits in a PCAP with traffic in both directions if a NSS key log is provided.
+Supports decoding of most standard records, messages and extensions. Can also decrypt most standard cipher suites in a PCAP with traffic in both directions if a NSS key log is provided.
-### Decode and decrypt provding a PCAP and key log
+### Decode and decrypt providing a PCAP and key log
Write traffic to a PCAP file:
@@ -8,7 +8,7 @@ Write traffic to a PCAP file:
$ tcpdump -i -w traffic.pcap
```
-Make sure your curl TLS backend support `SSLKEYLOGFILE` and do:
+Make sure your curl TLS backend supports `SSLKEYLOGFILE` and do:
```sh
$ SSLKEYLOGFILE=traffic.keylog curl --tls-max 1.2 https://host/path
```
@@ -69,58 +69,44 @@ $ fq -o keylog=@traffic.keylog 'first(grep_by(.server.stream | format == "tls")
`TLS_ECDH_RSA_WITH_RC4_128_SHA`,
`TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA`,
`TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`,
-`TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`,
`TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`,
`TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256`,
`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`,
-`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`,
`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`,
-`TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384eadAESGCM`,
+`TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384`,
`TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256`,
`TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305`,
`TLS_ECDHE_ECDSA_WITH_RC4_128_SHA`,
-`TLS_ECDHE_ECDSA_WITH_RC4_128_SHA`,
`TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA`,
`TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256`,
`TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA`,
`TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA`,
-`TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA`,
-`TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`,
`TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`,
`TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`,
`TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`,
`TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`,
-`TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`,
`TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`,
`TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`,
`TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256`,
`TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305`,
`TLS_ECDHE_RSA_WITH_RC4_128_SHA`,
-`TLS_ECDHE_RSA_WITH_RC4_128_SHA`,
`TLS_PSK_WITH_AES_128_CBC_SHA`,
`TLS_PSK_WITH_AES_256_CBC_SHA`,
`TLS_PSK_WITH_RC4_128_SHA`,
`TLS_RSA_EXPORT_WITH_DES40_CBC_SHA`,
`TLS_RSA_EXPORT_WITH_RC4_40_MD5`,
`TLS_RSA_WITH_3DES_EDE_CBC_SHA`,
-`TLS_RSA_WITH_3DES_EDE_CBC_SHA`,
-`TLS_RSA_WITH_AES_128_CBC_SHA`,
`TLS_RSA_WITH_AES_128_CBC_SHA`,
`TLS_RSA_WITH_AES_128_CBC_SHA256`,
-`TLS_RSA_WITH_AES_128_CBC_SHA256`,
`TLS_RSA_WITH_AES_128_GCM_SHA256`,
-`TLS_RSA_WITH_AES_128_GCM_SHA256`,
-`TLS_RSA_WITH_AES_256_CBC_SHA`,
`TLS_RSA_WITH_AES_256_CBC_SHA`,
`TLS_RSA_WITH_AES_256_CBC_SHA256`,
`TLS_RSA_WITH_AES_256_GCM_SHA384`,
-`TLS_RSA_WITH_AES_256_GCM_SHA384`,
`TLS_RSA_WITH_DES_CBC_SHA`,
`TLS_RSA_WITH_RC4_128_MD5`,
-`TLS_RSA_WITH_RC4_128_SHA`,
`TLS_RSA_WITH_RC4_128_SHA`
### References
- [RFC 5246: The Transport Layer Security (TLS) Protocol](https://www.rfc-editor.org/rfc/rfc5246)
-- [RFC 6101: The Secure Sockets Layer (SSL) Protocol Version 3.0](https://www.rfc-editor.org/rfc/rfc)
+- [RFC 6101: The Secure Sockets Layer (SSL) Protocol Version 3.0](https://www.rfc-editor.org/rfc/rfc6101)
diff --git a/format/tzx/tzx.md b/format/tzx/tzx.md
index 51792101e..108ab70a4 100644
--- a/format/tzx/tzx.md
+++ b/format/tzx/tzx.md
@@ -2,7 +2,7 @@
ZX Spectrum computers, although some specialized versions of the format have
been defined for other machines such as the Amstrad CPC and C64.
-The format was originally created by Tomaz Kac, who was maintainer until
+The format was originally created by Tomaz Kac, who was the maintainer until
`revision 1.13`, before passing it to Martijn v.d. Heide. For a brief period
the company Ramsoft became the maintainers, and created revision `v1.20`.
diff --git a/format/xml/html.md b/format/xml/html.md
index 39d015866..b3240b20b 100644
--- a/format/xml/html.md
+++ b/format/xml/html.md
@@ -1,4 +1,4 @@
-HTML is decoded in HTML5 mode and will always include ``, `` and `` element.
+HTML is decoded in HTML5 mode and will always include ``, `` and `` elements.
See xml format for more examples and how to preserve element order and how to encode to xml.
diff --git a/format/xml/testdata/help_html.fqtest b/format/xml/testdata/help_html.fqtest
index 8dcd06616..ee29b8dba 100644
--- a/format/xml/testdata/help_html.fqtest
+++ b/format/xml/testdata/help_html.fqtest
@@ -20,7 +20,7 @@ Decode examples
# Decode value as html
... | html({array:false,attribute_prefix:"@",seq:false})
-HTML is decoded in HTML5 mode and will always include , and element.
+HTML is decoded in HTML5 mode and will always include , and elements.
See xml format for more examples and how to preserve element order and how to encode to xml.
diff --git a/format/xml/testdata/help_xml.fqtest b/format/xml/testdata/help_xml.fqtest
index 9b11a4805..855f41a8f 100644
--- a/format/xml/testdata/help_xml.fqtest
+++ b/format/xml/testdata/help_xml.fqtest
@@ -20,11 +20,10 @@ Decode examples
# Decode value as xml
... | xml({array:false,attribute_prefix:"@",seq:false})
-XML can be decoded and encoded into jq values in two ways, elements as object or array. Which variant to use depends a bit what you
-want to do. The object variant might be easier to query for a specific value but array might be easier to use to generate xml or to
-query after all elements of some kind etc.
+XML can be decoded and encoded into jq values in two ways, elements as object or array. The object variant might be easier to query
+for a specific value but array might be easier to use to generate xml or to query after all elements of some kind etc.
-Encoding is done using the to_xml function and it will figure what variant that is used based on the input value. Is has two optional
+Encoding is done using the to_xml function and it will figure what variant that is used based on the input value. It has two optional
options indent and attribute_prefix.
Elements as object
@@ -75,7 +74,7 @@ order might be lost.
Elements as array
=================
-Elements are arrays of the shape ["#text": "body text", "attr_name", {key: "attr value"}|null, [, ...]].
+Elements are arrays of the shape ["name", null|{#text|attribute: "value"}, [, ...]].
# decode as array
$ echo 'bbbccc' | fq -d xml -o array=true
diff --git a/format/xml/xml.md b/format/xml/xml.md
index 439844274..b40b3c271 100644
--- a/format/xml/xml.md
+++ b/format/xml/xml.md
@@ -1,10 +1,10 @@
XML can be decoded and encoded into jq values in two ways, elements as object or array.
-Which variant to use depends a bit what you want to do. The object variant might be easier
+The object variant might be easier
to query for a specific value but array might be easier to use to generate xml or to query
after all elements of some kind etc.
Encoding is done using the `to_xml` function and it will figure what variant that is used based on the input value.
-Is has two optional options `indent` and `attribute_prefix`.
+It has two optional options `indent` and `attribute_prefix`.
### Elements as object
@@ -56,7 +56,7 @@ $ echo 'bbbccc' | fq -r -d xml -o seq=true
### Elements as array
-Elements are arrays of the shape `["#text": "body text", "attr_name", {key: "attr value"}|null, [, ...]]`.
+Elements are arrays of the shape `["name", null|{#text|attribute: "value"}, [, ...]]`.
```sh
# decode as array
diff --git a/pkg/interp/help.jq b/pkg/interp/help.jq
index a70c12ca2..601e41106 100644
--- a/pkg/interp/help.jq
+++ b/pkg/interp/help.jq
@@ -79,7 +79,7 @@ def help: help(null);
def _help($arg0; $topic):
( $topic
| if . == "usage" then
- "Usage: \($arg0) [OPTIONS] [--] [EXPR] [FILE...]"
+ "Usage: \($arg0) [OPTIONS] [--] [EXPRESSION] [FILE...]"
elif . == "example_usage" then
( "Example usages:"
, " fq . file"
diff --git a/pkg/interp/init.jq b/pkg/interp/init.jq
index 50f736d2c..6ae021406 100644
--- a/pkg/interp/init.jq
+++ b/pkg/interp/init.jq
@@ -172,7 +172,9 @@ def _main:
)
)
);
- ( . as {$version, $os, $arch, $go_version, $args, args: [$arg0]}
+ ( . as $main_input
+ | _main_input($main_input) as $_
+ | . as {$version, $os, $arch, $go_version, $args, args: [$arg0]}
# make sure we don't unintentionally use . to make things clearer
| null
| ( try _args_parse($args[1:]; _opt_cli_opts)
diff --git a/pkg/interp/internal.jq b/pkg/interp/internal.jq
index 461e26281..8cbfbe253 100644
--- a/pkg/interp/internal.jq
+++ b/pkg/interp/internal.jq
@@ -81,6 +81,9 @@ def _input_decode_errors(f): _global_var("input_decode_errors"; f);
def _slurps: _global_var("slurps");
def _slurps(f): _global_var("slurps"; f);
+def _main_input: _global_var("main_input");
+def _main_input(f): _global_var("main_input"; f );
+
# call f and finally eval fin even if empty or error.
# _finally(1; debug)
# _finally(null; debug)
diff --git a/pkg/interp/options.jq b/pkg/interp/options.jq
index 615a8f69c..457685cee 100644
--- a/pkg/interp/options.jq
+++ b/pkg/interp/options.jq
@@ -53,14 +53,13 @@ def _opt_build_default_fixed:
, expr: "."
, filenames: null
, force: false
- , include_path: null
+ , include_path: []
, join_string: "\n"
, null_input: false
, raw_file: []
, raw_output: ($stdout.is_terminal | not)
, raw_string: false
, repl: false
- , show_formats: false
, show_help: false
, sizebase: 10
, skip_gaps: false
@@ -74,48 +73,59 @@ def _opt_build_default_fixed:
);
def _opt_options:
- { addrbase: "number"
- , arg: "array_string_pair"
- , args: "array_string"
- , argdecode: "array_string_pair"
- , argjson: "array_string_pair"
- , argsjson: "array_string"
- , array_truncate: "number"
- , bits_format: "string"
- , byte_colors: "csv_ranges_array"
- , color: "boolean"
- , colors: "csv_kv_obj"
- , compact: "boolean"
- , completion_timeout: "number"
- , decode_group: "string"
- , decode_progress: "boolean"
- , depth: "number"
- , display_bytes: "number"
- , expr_eval_path: "string"
- , expr_file: "string"
- , expr_given: "boolean"
- , expr: "string"
- , filenames: "array_string"
- , force: "boolean"
- , include_path: "string"
- , join_string: "string"
- , line_bytes: "number"
- , null_input: "boolean"
- , raw_file: "array_string_pair"
- , raw_output: "boolean"
- , raw_string: "boolean"
- , repl: "boolean"
- , show_formats: "boolean"
- , show_help: "boolean"
- , sizebase: "number"
- , skip_gaps: "boolean"
- , slurp: "boolean"
- , string_input: "boolean"
- , string_truncate: "number"
- , unicode: "boolean"
- , value_output: "boolean"
- , verbose: "boolean"
- , width: "number"
+ { addrbase: {type: "number", description: "Number base for addresses"}
+ , arg: {type: "array_string_pair", description: "--arg pairs", internal: true}
+ , args: {type: "array_string", description: "--args arguments", internal: true}
+ , argdecode: {type: "array_string_pair", description: "--argdecode pairs", internal: true}
+ , argjson: {type: "array_string_pair", description: "--argjson pairs", internal: true}
+ , argsjson: {type: "array_string", description: "--argsjson arguments", internal :true}
+ , array_truncate: {type: "number", description: "Array display length to truncate"}
+ , bits_format:
+ { type: "string"
+ , description: "Raw bits representation"
+ , values:
+ { "base64": "Base64 string."
+ , "byte_array": "Array of bytes (zero bit padded if size is not byte aligned)."
+ , "hex": "Hex string."
+ , "md5": "MD5 hex string (zero bit padded)."
+ , "snippet": "Truncated Base64 string prefixed with bit length."
+ , "string": "String with raw bytes (zero bit padded if size is not byte aligned). The string is binary safe internally in fq but bytes not representable as UTF-8 will be lost if turned into JSON (default)."
+ , "truncate": "Truncated string."
+ }
+ }
+ , byte_colors: {type: "csv_ranges_array", description: "Byte value colorization"}
+ , color: {type: "boolean", description: "Use color"}
+ , colors: {type: "csv_kv_obj", description: "Color scheme"}
+ , compact: {type: "boolean", description: "Use compact JSON"}
+ , completion_timeout: {type: "number", description: "Seconds to wait for completion results"}
+ , decode_group: {type: "string", description: "Format to decode", internal: true}
+ , decode_progress: {type: "boolean", description: "Show decode progress", internal: true}
+ , depth: {type: "number", description: "Display tree depth limit"}
+ , display_bytes: {type: "number", description: "Display bytes limit"}
+ , expr_eval_path: {type: "string", description: "Where does expression come from", internal: true}
+ , expr_file: {type: "string", description: "Read expression from file", internal: true}
+ , expr_given: {type: "boolean", description: "An expression arg as given", internal: true}
+ , expr: {type: "string", description: "Expression to evaluate", internal: true}
+ , filenames: {type: "array_string", description: "Filenames arguments", internal: true}
+ , force: {type: "boolean", description: "Force decode"}
+ , include_path: {type: "array_string", description: "Include paths", internal: true}
+ , join_string: {type: "string", description: "String used to join outputs"}
+ , line_bytes: {type: "number", description: "Number of bytes per display line"}
+ , null_input: {type: "boolean", description: "Null input", internal: true}
+ , raw_file: {type: "array_string_pair", description: "--raw-file pairs", internal: true}
+ , raw_output: {type: "boolean", description: "Raw output is safe", internal: true}
+ , raw_string: {type: "boolean", description: "Raw string output"}
+ , repl: {type: "boolean", description: "Invole REPL", internal: true}
+ , show_help: {type: "boolean", description: "Show help", internal: true}
+ , sizebase: {type: "number", description: "Number base for sizes"}
+ , skip_gaps: {type: "boolean", description: "Skip gaps when representing decode value (arrays) as JSON"}
+ , slurp: {type: "boolean", description: "Slurp inputs into an array", internal: true}
+ , string_input: {type: "boolean", description: "Raw string input", internal: true}
+ , string_truncate: {type: "number", description: "String display length truncate"}
+ , unicode: {type: "boolean", description: "Use unicode"}
+ , value_output: {type: "boolean", description: "Output decode value as JSON", internal: true}
+ , verbose: {type: "boolean", description: "Verbose display"}
+ , width: {type: "number", description: "Terminal width"}
};
def _opt_eval($rest):
@@ -389,7 +399,7 @@ def _opt_cli_arg_to_options:
( _opt_options as $opts
| with_entries(
( .key as $k
- | .value |= _opt_to($opts[$k] // "fuzzy")
+ | .value |= _opt_to($opts[$k].type // "fuzzy")
| select(.value != null)
)
)
@@ -399,7 +409,8 @@ def _opt_cli_arg_from_options:
( _opt_options as $opts
| with_entries(
( .key as $k
- | .value |= _opt_from($opts[$k] // "string")
+ | select($opts[$k].internal | not)
+ | .value |= _opt_from($opts[$k].type // "string")
| select(.value != null)
)
)
@@ -408,19 +419,19 @@ def _opt_cli_arg_from_options:
def _opt_cli_opts:
{ arg:
{ long: "--arg"
- , description: "Set variable $NAME to string VALUE"
+ , description: "Set $NAME to string VALUE"
, pairs: "NAME VALUE"
}
, argdecode:
{ long: "--argdecode"
# TODO: remove at some point
, aliases: ["--decode-file"]
- , description: "Set variable $NAME to decode of PATH"
+ , description: "Set $NAME to decode of PATH"
, pairs: "NAME PATH"
}
, argjson:
{ long: "--argjson"
- , description: "Set variable $NAME to JSON"
+ , description: "Set $NAME to JSON"
, pairs: "NAME JSON"
}
, args:
@@ -436,7 +447,7 @@ def _opt_cli_opts:
, compact:
{ short: "-c"
, long: "--compact-output"
- , description: "Compact output"
+ , description: "Use compact output"
, bool: true
}
, color_output:
@@ -454,7 +465,7 @@ def _opt_cli_opts:
, expr_file:
{ short: "-f"
, long: "--from-file"
- , description: "Read EXPR from file"
+ , description: "Read EXPRESSION from file"
, string: "PATH"
}
, show_help:
@@ -473,7 +484,7 @@ def _opt_cli_opts:
, include_path:
{ short: "-L"
, long: "--include-path"
- , description: "Include search path"
+ , description: "Add PATH to include search paths"
, array: "PATH"
}
, null_output:
@@ -486,7 +497,7 @@ def _opt_cli_opts:
, null_input:
{ short: "-n"
, long: "--null-input"
- , description: "Null input (use input and inputs functions to read)"
+ , description: "Null input (use input and inputs to read)"
, bool: true
}
, monochrome_output:
@@ -499,7 +510,7 @@ def _opt_cli_opts:
{ short: "-o"
, long: "--option"
, description: "Set option (ex: -o color=true, see --help options)"
- , object: "KEY=VALUE/@PATH",
+ , object: "NAME=VALUE/@PATH",
}
, string_input:
{ short: "-R"
@@ -511,7 +522,7 @@ def _opt_cli_opts:
{ long: "--raw-file"
# for jq compatibility
, aliases: ["--raw-file"]
- , description: "Set variable $NAME to string content of file"
+ , description: "Set $NAME to string content of file"
, pairs: "NAME PATH"
}
, raw_string:
diff --git a/pkg/interp/testdata/args.fqtest b/pkg/interp/testdata/args.fqtest
index 7bc700bfa..6d1ab1cd2 100644
--- a/pkg/interp/testdata/args.fqtest
+++ b/pkg/interp/testdata/args.fqtest
@@ -1,7 +1,7 @@
$ fq
exitcode: 2
stderr:
-Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
+Usage: fq [OPTIONS] [--] [EXPRESSION] [FILE...]
$ _STDIN_IS_TERMINAL=1 fq type
"number"
stdin:
@@ -11,7 +11,7 @@ fq - jq for binary formats
Tool, language and decoders for working with binary data.
For more information see https://github.com/wader/fq
-Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
+Usage: fq [OPTIONS] [--] [EXPRESSION] [FILE...]
Example usages:
fq . file
@@ -24,30 +24,30 @@ Example usages:
fq 'grep("^main$") | parent' /bin/ls
fq -i
---arg NAME VALUE Set variable $NAME to string VALUE
---argdecode NAME PATH Set variable $NAME to decode of PATH
---argjson NAME JSON Set variable $NAME to JSON
---args Consume remaining arguments as positional strings
---color-output,-C Force color output
---compact-output,-c Compact output
---decode,-d NAME Decode format or group (probe)
---from-file,-f PATH Read EXPR from file
---help,-h [TOPIC] Show help for TOPIC (ex: -h formats, -h mp4)
---include-path,-L PATH Include search path
---join-output,-j No newline after each output
---jsonargs Consume remaining arguments as positional JSON
---monochrome-output,-M Force monochrome output
---null-input,-n Null input (use input and inputs functions to read)
---option,-o KEY=VALUE/@PATH Set option (ex: -o color=true, see --help options)
---raw-file NAME PATH Set variable $NAME to string content of file
---raw-input,-R Read raw input strings (don't decode)
---raw-output,-r Raw string output (without quotes)
---raw-output0 NUL (zero) byte after each output
---repl,-i Interactive REPL
---slurp,-s Slurp all inputs into an array or string (-Rs)
---unicode-output,-U Force unicode output
---value-output,-V Output JSON value (-Vr for raw string)
---version,-v Show version
+--arg NAME VALUE Set $NAME to string VALUE
+--argdecode NAME PATH Set $NAME to decode of PATH
+--argjson NAME JSON Set $NAME to JSON
+--args Consume remaining arguments as positional strings
+--color-output,-C Force color output
+--compact-output,-c Use compact output
+--decode,-d NAME Decode format or group (probe)
+--from-file,-f PATH Read EXPRESSION from file
+--help,-h [TOPIC] Show help for TOPIC (ex: -h formats, -h mp4)
+--include-path,-L PATH Add PATH to include search paths
+--join-output,-j No newline after each output
+--jsonargs Consume remaining arguments as positional JSON
+--monochrome-output,-M Force monochrome output
+--null-input,-n Null input (use input and inputs to read)
+--option,-o NAME=VALUE/@PATH Set option (ex: -o color=true, see --help options)
+--raw-file NAME PATH Set $NAME to string content of file
+--raw-input,-R Read raw input strings (don't decode)
+--raw-output,-r Raw string output (without quotes)
+--raw-output0 NUL (zero) byte after each output
+--repl,-i Interactive REPL
+--slurp,-s Slurp all inputs into an array or string (-Rs)
+--unicode-output,-U Force unicode output
+--value-output,-V Output JSON value (-Vr for raw string)
+--version,-v Show version
$ fq -i
null> ^D
$ fq -i . test.mp3
@@ -70,11 +70,6 @@ $ fq -nc "[1,2,3]"
[1,2,3]
$ fq --help options
addrbase 16
-arg []
-argdecode []
-argjson []
-args []
-argsjson []
array_truncate 50
bits_format string
byte_colors 0-255=default+bold,0=brightblack,32-126:9-13=default
@@ -82,33 +77,16 @@ color false
colors array=default,dumpaddr=yellow,dumpheader=yellow+underline,error=brightred,false=yellow,index=default,null=brightblack,number=cyan,object=default,objectkey=brightblue,prompt_repl_level=brightblack,prompt_value=default,string=green,true=yellow,value=default
compact false
completion_timeout 10
-decode_group probe
-decode_progress false
depth 0
display_bytes 16
-expr .
-expr_eval_path arg
-expr_file
-expr_given false
-filenames [null]
force false
-include_path
join_string \n
line_bytes 16
-null_input false
-raw_file []
-raw_output false
raw_string false
-repl false
-show_formats false
-show_help options
sizebase 10
skip_gaps false
-slurp false
-string_input false
string_truncate 50
unicode false
-value_output false
verbose false
width 135
$ fq -X
diff --git a/pkg/interp/testdata/exitcode.fqtest b/pkg/interp/testdata/exitcode.fqtest
index 17c3affac..dc69822bc 100644
--- a/pkg/interp/testdata/exitcode.fqtest
+++ b/pkg/interp/testdata/exitcode.fqtest
@@ -1,7 +1,7 @@
$ fq
exitcode: 2
stderr:
-Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
+Usage: fq [OPTIONS] [--] [EXPRESSION] [FILE...]
$ fq -n '1+"a"'
exitcode: 5
stderr:
diff --git a/pkg/interp/testdata/options.fqtest b/pkg/interp/testdata/options.fqtest
index 82b8dddc5..40dc3b3d9 100644
--- a/pkg/interp/testdata/options.fqtest
+++ b/pkg/interp/testdata/options.fqtest
@@ -74,7 +74,7 @@ $ fq -n options
null
],
"force": false,
- "include_path": null,
+ "include_path": [],
"join_string": "\n",
"line_bytes": 16,
"null_input": true,
@@ -82,7 +82,6 @@ $ fq -n options
"raw_output": false,
"raw_string": false,
"repl": false,
- "show_formats": false,
"show_help": false,
"sizebase": 10,
"skip_gaps": false,
@@ -153,7 +152,7 @@ $ fq -o 'filenames=["test.mp3"]' format
$ fq -o 'force=true' -n options.force
true
$ fq -o include_path=path -n options.include_path
-"path"
+[]
$ fq -o 'join_string=aaa\n' -n options.join_string
"aaa\n"aaa
$ fq -o line_bytes=true -n options.line_bytes