Skip to content

Commit 496849d

Browse files
authored
Merge pull request #936 from wader/update-docs
doc: Cleanup and improve texts a bit
2 parents b8eec40 + ebf063d commit 496849d

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

README.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22

33
Tool, language and decoders for working with binary data.
44

5+
TLDR: it aims to be jq, hexdump, dd and gdb for files combined into one.
6+
57
![fq demo](doc/demo.svg)
68

7-
Basic usage is `fq . file` or `fq d file`.
9+
Basic usage is `fq . file`, `fq d file` or `fq 'some query' file ...`.
810

911
For details see [usage.md](doc/usage.md).
1012

1113
### Background
1214

13-
fq is inspired by the well known jq tool and language that allows you to work with binary formats the same way you would using jq. In addition it can present data like a hex viewer, transform, slice and concatenate binary data. It also supports nested formats and has an interactive REPL with auto-completion.
14-
15-
It was originally designed to query, inspect and debug media codecs and containers like mp4, flac, mp3, jpeg. But since then it has been extended to support a variety of formats like executables, packet captures (with TCP reassembly) and serialization formats like JSON, YAML, XML, ASN1 BER, Avro, CBOR, protobuf. In addition it also has functions to work with URLs, convert to/from hex, number bases, search for things etc.
16-
17-
In summary it aims to be jq, hexdump, dd and gdb for files combined into one.
15+
fq is inspired by the [jq](https://jqlang.github.io/jq/) tool and language and allows you to work with binary formats in the same way. In addition to using jq expressions it can also present decoded tree structures, transform, slice and concatenate binary data. It also supports nested formats and features an interactive REPL with auto-completion of functions and names.
1816

19-
**NOTE:** fq is still early in development so things might change, be broken or do not make sense. That also means that there is a great opportunity to help out!
17+
It was originally designed to query, inspect and debug media codecs and containers like MP4, FLAC and JPEG but has since been extended to support a variety of formats like executables, packet captures (with TCP reassembly) and serialization formats like JSON, YAML, XML, CBOR, protobuf. In addition it also has functions to work with URLs, convert to/from hex, number bases, search for patterns etc.
2018

2119
### Goals
2220

23-
- Make binaries accessible, queryable and sliceable.
21+
- Make binaries more accessible, queryable and sliceable.
2422
- Nested formats and bit-oriented decoding.
2523
- Quick and comfortable CLI tool.
2624
- Bits and bytes transformations.
@@ -243,7 +241,7 @@ apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing fq
243241

244242
Make sure you have [go](https://go.dev) 1.20 or later installed.
245243

246-
To install directly from git repository (no clone needed):
244+
To install directly from git repository (no git clone needed):
247245
```sh
248246
# build and install latest release
249247
go install github.com/wader/fq@latest
@@ -267,10 +265,6 @@ go build -o fq .
267265
make test fq
268266
```
269267

270-
## TODO and ideas
271-
272-
See [TODO.md](doc/TODO.md)
273-
274268
## Development and adding a new decoder
275269

276270
See [dev.md](doc/dev.md)
@@ -306,6 +300,10 @@ for inventing the [jq](https://github.com/stedolan/jq) language.
306300
- [Sustainability of Digital Formats](https://www.loc.gov/preservation/digital/formats/) at Library of Congress.
307301
- [Data Format Description Language (DFDL)](https://en.wikipedia.org/wiki/Data_Format_Description_Language).
308302

303+
## TODO and ideas
304+
305+
See [TODO.md](doc/TODO.md)
306+
309307
## License
310308

311309
`fq` is distributed under the terms of the MIT License.

doc/dev.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ make test
236236
go test ./...
237237
# run all tests for one format
238238
go test -run TestFormats/mp4 ./format/
239-
# update all actual outputs in tests
240-
go test ./... -update
239+
# update all expected outputs for tests
240+
go test ./pkg/interp ./format -update
241241
# update actual output for specific tests
242242
go run ./format -run TestFormats/elf -update
243243
# color diff

pkg/interp/help.jq

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ Same as recurse without argument.
5454
}
5555
};
5656

57-
def help($_): error("help must be alone or last in pipeline. ex: help(length) or ... | help");
58-
def help: help(null);
59-
6057
def _help_format_enrich($arg0; $f; $include_basic):
6158
( if $include_basic then
6259
.examples +=
@@ -76,6 +73,9 @@ def _help_format_enrich($arg0; $f; $include_basic):
7673
end
7774
);
7875

76+
# trailing help gets rewritten to _help_slurp, these are here to catch other variants
77+
def help($_): error("help must be alone or last in pipeline. ex: help(length) or ... | help");
78+
def help: help(null);
7979
def _help($arg0; $topic):
8080
( $topic
8181
| if . == "usage" then
@@ -236,7 +236,7 @@ def _help($arg0; $topic):
236236
| ($args | length) as $argc
237237
| if $args == null then
238238
# help
239-
( "Type expression to evaluate"
239+
( "Type jq expression to evaluate"
240240
, "help(...) Help for topic. Ex: help(mp4), help(\"mp4\")"
241241
, "\\t Completion"
242242
, "Up/Down History"

pkg/interp/testdata/help.fqtest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$ fq -ni
22
null> help
3-
Type expression to evaluate
3+
Type jq expression to evaluate
44
help(...) Help for topic. Ex: help(mp4), help("mp4")
55
\t Completion
66
Up/Down History

0 commit comments

Comments
 (0)