mirror of
https://github.com/wader/fq.git
synced 2024-10-26 20:06:29 +03:00
Compare commits
42 Commits
f93321e6b0
...
4adfb9a89c
Author | SHA1 | Date | |
---|---|---|---|
|
4adfb9a89c | ||
|
943743dbaf | ||
|
1b85ae622b | ||
|
f6d7235449 | ||
|
aef47df26a | ||
|
1ec9748046 | ||
|
2e5514fc50 | ||
|
a59ba2a2fa | ||
|
7714fcf423 | ||
|
544cf4cc09 | ||
|
25ad5f1c8f | ||
|
9ff7da12a7 | ||
|
94cfbc670c | ||
|
163b3b609c | ||
|
cabb67e8ab | ||
|
64df8bdbf5 | ||
|
481ac91880 | ||
|
14ada50806 | ||
|
12f332064c | ||
|
0ff3e53c5f | ||
|
586cf142e5 | ||
|
fb20db5eb7 | ||
|
48868bd4ee | ||
|
c5c8b75c56 | ||
|
a5de74cd23 | ||
|
42730d7586 | ||
|
3a683b64f8 | ||
|
496849daa5 | ||
|
ebf063d1c0 | ||
|
b8eec4078f | ||
|
6e13b4b550 | ||
|
9eee65072f | ||
|
6db6a54d13 | ||
|
08ced4515f | ||
|
6059b9ee1b | ||
|
f746dab7b2 | ||
|
b482556025 | ||
|
4674060dfe | ||
|
ad2c032c7e | ||
|
d30755b06e | ||
|
2b12258eba | ||
|
5c8f088328 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GOLANGCILINT_VERSION: "1.57.2"
|
GOLANGCILINT_VERSION: "1.58.2"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22.2"
|
go-version: "1.22.3"
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: golangci/golangci-lint-action@v3
|
- uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
@ -47,7 +47,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22.2"
|
go-version: "1.22.3"
|
||||||
- name: Test
|
- name: Test
|
||||||
env:
|
env:
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -15,8 +15,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22.2"
|
go-version: "1.22.3"
|
||||||
- uses: goreleaser/goreleaser-action@v2
|
- uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
|
@ -59,7 +59,7 @@ brews:
|
|||||||
repository:
|
repository:
|
||||||
owner: wader
|
owner: wader
|
||||||
name: homebrew-tap
|
name: homebrew-tap
|
||||||
folder: Formula
|
directory: Formula
|
||||||
homepage: https://github.com/wader/fq
|
homepage: https://github.com/wader/fq
|
||||||
description: jq for binary formats
|
description: jq for binary formats
|
||||||
license: MIT
|
license: MIT
|
||||||
|
86
CHANGES.md
86
CHANGES.md
@ -1,3 +1,88 @@
|
|||||||
|
# 0.11.0
|
||||||
|
|
||||||
|
New iNES/NES 2.0 ROM decoder (thanks @mlofjard) and basic JPEG 2000 format support. jq language improvements and fixes from gojq. And as always various decoder improvements and fixes.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Add `string_truncate` option to configure how to truncate long strings when displaying a decode value tree. `dd`, `dv` etc set truncate length to zero to not truncate. #919
|
||||||
|
- gojq updates from upstream:
|
||||||
|
- Implement `ltrim`, `rtrim`, and `trim` functions
|
||||||
|
- Fix object construction with duplicate keys (`{x:0,y:1} | {a:.x,a:.y}`)
|
||||||
|
- Fix `halt` and `halt_error` functions to stop the command execution immediately
|
||||||
|
- Fix variable scope of binding syntax (`"a" as $v | def f: $v; "b" as $v | f`)
|
||||||
|
- Fix `ltrimstr` and `rtrimstr` functions to emit error on non-string input
|
||||||
|
- Fix `nearbyint` and `rint` functions to round ties to even
|
||||||
|
- Improve parser to allow `reduce`, `foreach`, `if`, `try`-`catch` syntax as object values
|
||||||
|
- Remove `pow10` in favor of `exp10`, define `scalbn` and `scalbln` by `ldexp`
|
||||||
|
- Fix issue using decode value with `ltrimstr`/`rtrimstr`.
|
||||||
|
|
||||||
|
## Format changes
|
||||||
|
|
||||||
|
- `fit`
|
||||||
|
- Skip array fields on pre read messages. #878
|
||||||
|
- Fixed subfield referencing fields below self in message. #877
|
||||||
|
- `jp2c` New JPEG 2000 codestream decoder. #928
|
||||||
|
- `icc_profile` Strip whitespace in header and tag strings. #912
|
||||||
|
- `mp4`
|
||||||
|
- Add `jp2c`, `jp2h`, `ihdr` `jP` JPEG 2000 related boxes support. #928
|
||||||
|
- Add `thmb` box support. #897
|
||||||
|
- Turns out for qt brand `hdlr` component name might be zero bytes. #896
|
||||||
|
- `nes` New iNES/NES 2.0 ROM decoder (thanks @mlofjard). #893
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
* f7b067b6 Fixed subfield referencing fields below self in message
|
||||||
|
* 9aa99b47 Update docker-golang to 1.22.1 from 1.22.0
|
||||||
|
* 0afb5b59 Update docker-golang to 1.22.2 from 1.22.1
|
||||||
|
* 2657988d Update github-go-version to 1.22.1 from 1.22.0
|
||||||
|
* 33c93918 Update github-go-version to 1.22.2 from 1.22.1
|
||||||
|
* a577c398 Update github-golangci-lint to 1.56.2 from 1.56.1
|
||||||
|
* 82d96cf9 Update github-golangci-lint to 1.57.0 from 1.56.2
|
||||||
|
* 72b4569b Update github-golangci-lint to 1.57.1 from 1.57.0
|
||||||
|
* 14aeab0b Update github-golangci-lint to 1.57.2 from 1.57.1
|
||||||
|
* 735256b9 Update gomod-golang-x-crypto to 0.20.0 from 0.19.0
|
||||||
|
* 043f067f Update gomod-golang-x-crypto to 0.21.0 from 0.20.0
|
||||||
|
* 15a7060b Update gomod-golang-x-crypto to 0.22.0 from 0.21.0
|
||||||
|
* 85f60df2 Update gomod-golang-x-net to 0.22.0 from 0.21.0
|
||||||
|
* 77c000e6 Update gomod-golang-x-net to 0.23.0 from 0.22.0
|
||||||
|
* daba6b54 Update gomod-golang-x-net to 0.24.0 from 0.23.0
|
||||||
|
* ba9ecb54 Update gomod-golang-x-term to 0.18.0 from 0.17.0
|
||||||
|
* b2aa59f7 Update gomod-golang-x-term to 0.19.0 from 0.18.0
|
||||||
|
* 1c24f64d Update make-golangci-lint to 1.56.2 from 1.56.1
|
||||||
|
* 94e80864 Update make-golangci-lint to 1.57.0 from 1.56.2
|
||||||
|
* 4f55b6af Update make-golangci-lint to 1.57.1 from 1.57.0
|
||||||
|
* a3b63b10 Update make-golangci-lint to 1.57.2 from 1.57.1
|
||||||
|
* 208b3e6b chore: fix function name in comment
|
||||||
|
* 621d7f2c decode: Align some heavily used structs to save space
|
||||||
|
* ee2ee24d decode: Cleanup io panic a bit
|
||||||
|
* e741ca78 doc: Add ImHex to related tools
|
||||||
|
* 36e8287c doc: Regenerate after nes and new ansisvg
|
||||||
|
* 225fd507 fit: Skip array fields on pre read messages
|
||||||
|
* 7500a8b7 fq: Sort formats
|
||||||
|
* bf7fa07c fq: Use go 1.20 and cleanup
|
||||||
|
* e2670404 gojq: Update fq fork
|
||||||
|
* f5fd5873 gojq: Update fq fork
|
||||||
|
* ed685116 icc_profile: Strip whitespace in header and tag strings
|
||||||
|
* c8f9cdc9 interp: Add string_truncate option
|
||||||
|
* 0db671f6 interp: Add todo test for eval error in path
|
||||||
|
* ebffb3be jp2c: Add jpeg2000 codestream format
|
||||||
|
* 79992b34 jp2c: Fail probe faster
|
||||||
|
* 63f7d79c jp2c: Support probe
|
||||||
|
* b542ff1d lint: More linters and some fixes
|
||||||
|
* c6165c0c mod: go get non-bump tracked modules
|
||||||
|
* 1784c438 mp4,avi: Trim spaces for type
|
||||||
|
* 2ea70c42 mp4: Add thmb box support
|
||||||
|
* 4f90a2ea mp4: Decode jP box
|
||||||
|
* 70b1b0d6 mp4: Decode uinf box
|
||||||
|
* 87b6c4dd mp4: Fix jp2 test
|
||||||
|
* 8009b6f6 mp4: JPEG200 boxes jp2h and ihdr
|
||||||
|
* ed3a126f mp4: Turns out for qt brand hdlr component name might be zero bytes
|
||||||
|
* f3b54042 nes: Add support for iNES/NES 2.0 ROM files
|
||||||
|
* 80bccc91 opus,vorbis: More sym snake_case
|
||||||
|
* 08df7f45 pkg/cli/test_exp.sh: use command -v
|
||||||
|
* 87052733 pssh_playready: Use snake_case sym values
|
||||||
|
* aaa43dfb test: Replace pmezard/go-difflib with go's internal diff
|
||||||
|
|
||||||
# 0.10.0
|
# 0.10.0
|
||||||
|
|
||||||
Adds support for various LevelDB formats (thanks @mikez) and Garmin Flexible and Interoperable Data Transfer format (FIT) (thanks @mlofjard).
|
Adds support for various LevelDB formats (thanks @mikez) and Garmin Flexible and Interoperable Data Transfer format (FIT) (thanks @mlofjard).
|
||||||
@ -43,7 +128,6 @@ And as usual some small fixes and dependency updates.
|
|||||||
$ fq -L . -r 'include "to_kml"; to_kml' file.fit > file.kml
|
$ fq -L . -r 'include "to_kml"; to_kml' file.fit > file.kml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
- `hevc_sps` Fix some incorrect profile_tier_level decoding. #829
|
- `hevc_sps` Fix some incorrect profile_tier_level decoding. #829
|
||||||
- `html` Fix issue parsing elements including SOLIDUS "/". #870
|
- `html` Fix issue parsing elements including SOLIDUS "/". #870
|
||||||
- Upstream issue https://github.com/golang/go/issues/63402
|
- Upstream issue https://github.com/golang/go/issues/63402
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# bump: docker-golang /FROM golang:([\d.]+)/ docker:golang|^1
|
# bump: docker-golang /FROM golang:([\d.]+)/ docker:golang|^1
|
||||||
FROM golang:1.22.2-bookworm AS base
|
FROM golang:1.22.3-bookworm AS base
|
||||||
|
|
||||||
# expect is used to test cli
|
# expect is used to test cli
|
||||||
RUN \
|
RUN \
|
||||||
|
2
Makefile
2
Makefile
@ -61,7 +61,7 @@ gogenerate: always
|
|||||||
lint: always
|
lint: always
|
||||||
# bump: make-golangci-lint /golangci-lint@v([\d.]+)/ git:https://github.com/golangci/golangci-lint.git|^1
|
# bump: make-golangci-lint /golangci-lint@v([\d.]+)/ git:https://github.com/golangci/golangci-lint.git|^1
|
||||||
# bump: make-golangci-lint link "Release notes" https://github.com/golangci/golangci-lint/releases/tag/v$LATEST
|
# bump: make-golangci-lint link "Release notes" https://github.com/golangci/golangci-lint/releases/tag/v$LATEST
|
||||||
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run
|
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.2 run
|
||||||
|
|
||||||
depgraph.svg: always
|
depgraph.svg: always
|
||||||
go run github.com/kisielk/godepgraph@latest github.com/wader/fq | dot -Tsvg -o godepgraph.svg
|
go run github.com/kisielk/godepgraph@latest github.com/wader/fq | dot -Tsvg -o godepgraph.svg
|
||||||
|
24
README.md
24
README.md
@ -2,25 +2,23 @@
|
|||||||
|
|
||||||
Tool, language and decoders for working with binary data.
|
Tool, language and decoders for working with binary data.
|
||||||
|
|
||||||
|
TLDR: it aims to be jq, hexdump, dd and gdb for files combined into one.
|
||||||
|
|
||||||
![fq demo](doc/demo.svg)
|
![fq demo](doc/demo.svg)
|
||||||
|
|
||||||
Basic usage is `fq . file` or `fq d file`.
|
Basic usage is `fq . file`, `fq d file` or `fq 'some query' file ...`.
|
||||||
|
|
||||||
For details see [usage.md](doc/usage.md).
|
For details see [usage.md](doc/usage.md).
|
||||||
|
|
||||||
### Background
|
### Background
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
In summary it aims to be jq, hexdump, dd and gdb for files combined into one.
|
|
||||||
|
|
||||||
**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!
|
|
||||||
|
|
||||||
### Goals
|
### Goals
|
||||||
|
|
||||||
- Make binaries accessible, queryable and sliceable.
|
- Make binaries more accessible, queryable and sliceable.
|
||||||
- Nested formats and bit-oriented decoding.
|
- Nested formats and bit-oriented decoding.
|
||||||
- Quick and comfortable CLI tool.
|
- Quick and comfortable CLI tool.
|
||||||
- Bits and bytes transformations.
|
- Bits and bytes transformations.
|
||||||
@ -243,7 +241,7 @@ apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing fq
|
|||||||
|
|
||||||
Make sure you have [go](https://go.dev) 1.20 or later installed.
|
Make sure you have [go](https://go.dev) 1.20 or later installed.
|
||||||
|
|
||||||
To install directly from git repository (no clone needed):
|
To install directly from git repository (no git clone needed):
|
||||||
```sh
|
```sh
|
||||||
# build and install latest release
|
# build and install latest release
|
||||||
go install github.com/wader/fq@latest
|
go install github.com/wader/fq@latest
|
||||||
@ -267,10 +265,6 @@ go build -o fq .
|
|||||||
make test fq
|
make test fq
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO and ideas
|
|
||||||
|
|
||||||
See [TODO.md](doc/TODO.md)
|
|
||||||
|
|
||||||
## Development and adding a new decoder
|
## Development and adding a new decoder
|
||||||
|
|
||||||
See [dev.md](doc/dev.md)
|
See [dev.md](doc/dev.md)
|
||||||
@ -306,6 +300,10 @@ for inventing the [jq](https://github.com/stedolan/jq) language.
|
|||||||
- [Sustainability of Digital Formats](https://www.loc.gov/preservation/digital/formats/) at Library of Congress.
|
- [Sustainability of Digital Formats](https://www.loc.gov/preservation/digital/formats/) at Library of Congress.
|
||||||
- [Data Format Description Language (DFDL)](https://en.wikipedia.org/wiki/Data_Format_Description_Language).
|
- [Data Format Description Language (DFDL)](https://en.wikipedia.org/wiki/Data_Format_Description_Language).
|
||||||
|
|
||||||
|
## TODO and ideas
|
||||||
|
|
||||||
|
See [TODO.md](doc/TODO.md)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
`fq` is distributed under the terms of the MIT License.
|
`fq` is distributed under the terms of the MIT License.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//go:build exclude
|
||||||
|
|
||||||
// tool to convert go fuzz input files to bytes
|
// tool to convert go fuzz input files to bytes
|
||||||
// Usage: cat format/testdata/fuzz/FuzzFormats/144bde49b40c90fd05d302ec90b6ddb2b6d6aea553bad520a8b954797e40fe72 | go run dev/fuzzbytes.go | go run .
|
// Usage: cat format/testdata/fuzz/FuzzFormats/144bde49b40c90fd05d302ec90b6ddb2b6d6aea553bad520a8b954797e40fe72 | go run dev/fuzzbytes.go | go run .
|
||||||
package main
|
package main
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//go:build exclude
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -236,8 +236,8 @@ make test
|
|||||||
go test ./...
|
go test ./...
|
||||||
# run all tests for one format
|
# run all tests for one format
|
||||||
go test -run TestFormats/mp4 ./format/
|
go test -run TestFormats/mp4 ./format/
|
||||||
# update all actual outputs in tests
|
# update all expected outputs for tests
|
||||||
go test ./... -update
|
go test ./pkg/interp ./format -update
|
||||||
# update actual output for specific tests
|
# update actual output for specific tests
|
||||||
go run ./format -run TestFormats/elf -update
|
go run ./format -run TestFormats/elf -update
|
||||||
# color diff
|
# color diff
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
//go:build exclude
|
||||||
|
|
||||||
|
package bts2022
|
||||||
|
|
||||||
|
import "github.com/wader/fq/pkg/decode"
|
||||||
|
|
||||||
func avcHdrParameters(d *decode.D) {
|
func avcHdrParameters(d *decode.D) {
|
||||||
cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UAdd(1))
|
cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UAdd(1))
|
||||||
d.FieldU4("bit_rate_scale")
|
d.FieldU4("bit_rate_scale")
|
||||||
@ -15,4 +21,4 @@ func avcHdrParameters(d *decode.D) {
|
|||||||
d.FieldU5("cpb_removal_delay_length", scalar.UAdd(1))
|
d.FieldU5("cpb_removal_delay_length", scalar.UAdd(1))
|
||||||
d.FieldU5("dpb_output_delay_length", scalar.UAdd(1))
|
d.FieldU5("dpb_output_delay_length", scalar.UAdd(1))
|
||||||
d.FieldU5("time_offset_length")
|
d.FieldU5("time_offset_length")
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
//go:build exclude
|
||||||
|
|
||||||
|
package bts2022
|
||||||
|
|
||||||
func decode(d *decode.D) any {
|
func decode(d *decode.D) any {
|
||||||
d.FieldArray("headers", func(d *decode.D) {
|
d.FieldArray("headers", func(d *decode.D) {
|
||||||
for !d.End() {
|
for !d.End() {
|
||||||
|
@ -124,7 +124,7 @@ var markers = scalar.UintMap{
|
|||||||
RST6: {Sym: "rst6", Description: "Restart with modulo 8 count 6"},
|
RST6: {Sym: "rst6", Description: "Restart with modulo 8 count 6"},
|
||||||
RST7: {Sym: "rst7", Description: "Restart with modulo 8 count 7"},
|
RST7: {Sym: "rst7", Description: "Restart with modulo 8 count 7"},
|
||||||
SOI: {Sym: "soi", Description: "Start of image"},
|
SOI: {Sym: "soi", Description: "Start of image"},
|
||||||
EOI: {Sym: "eoi", Description: "End of image true"},
|
EOI: {Sym: "eoi", Description: "End of image"},
|
||||||
SOS: {Sym: "sos", Description: "Start of scan"},
|
SOS: {Sym: "sos", Description: "Start of scan"},
|
||||||
DQT: {Sym: "dqt", Description: "Define quantization table(s)"},
|
DQT: {Sym: "dqt", Description: "Define quantization table(s)"},
|
||||||
DNL: {Sym: "dnl", Description: "Define number of lines"},
|
DNL: {Sym: "dnl", Description: "Define number of lines"},
|
||||||
@ -262,6 +262,29 @@ func jpegDecode(d *decode.D) any {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
case DHT:
|
||||||
|
lH := int64(d.FieldU16("lh"))
|
||||||
|
d.FramedFn(lH*8-16, func(d *decode.D) {
|
||||||
|
d.FieldArray("hs", func(d *decode.D) {
|
||||||
|
for d.NotEnd() {
|
||||||
|
d.FieldStruct("h", func(d *decode.D) {
|
||||||
|
d.FieldU4("tc")
|
||||||
|
d.FieldU4("th")
|
||||||
|
hK := uint64(0)
|
||||||
|
hV := uint64(0)
|
||||||
|
d.FieldArrayLoop("l", func() bool { return hK < 16 }, func(d *decode.D) {
|
||||||
|
hV += d.FieldU8("l")
|
||||||
|
hK++
|
||||||
|
})
|
||||||
|
hK = 0
|
||||||
|
d.FieldArrayLoop("v", func() bool { return hK < hV }, func(d *decode.D) {
|
||||||
|
d.FieldU8("v")
|
||||||
|
hK++
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
case RST0, RST1, RST2, RST3, RST4, RST5, RST6, RST7:
|
case RST0, RST1, RST2, RST3, RST4, RST5, RST6, RST7:
|
||||||
inECD = true
|
inECD = true
|
||||||
case TEM:
|
case TEM:
|
||||||
|
56
format/jpeg/testdata/4x4.fqtest
vendored
56
format/jpeg/testdata/4x4.fqtest
vendored
@ -109,15 +109,57 @@ $ fq -d jpeg dv 4x4.jpg
|
|||||||
| | | [4]{}: marker 0x66-0x7c (22)
|
| | | [4]{}: marker 0x66-0x7c (22)
|
||||||
0x60| ff | . | prefix: raw bits (valid) 0x66-0x67 (1)
|
0x60| ff | . | prefix: raw bits (valid) 0x66-0x67 (1)
|
||||||
0x60| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x67-0x68 (1)
|
0x60| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x67-0x68 (1)
|
||||||
0x60| 00 14 | .. | length: 20 0x68-0x6a (2)
|
0x60| 00 14 | .. | lh: 20 0x68-0x6a (2)
|
||||||
0x60| 00 01 00 00 00 00| ......| data: raw bits 0x6a-0x7c (18)
|
| | | hs[0:1]: 0x6a-0x7c (18)
|
||||||
0x70|00 00 00 00 00 00 00 00 00 00 00 08 |............ |
|
| | | [0]{}: h 0x6a-0x7c (18)
|
||||||
|
0x60| 00 | . | tc: 0 0x6a-0x6a.4 (0.4)
|
||||||
|
0x60| 00 | . | th: 0 0x6a.4-0x6b (0.4)
|
||||||
|
| | | l[0:16]: 0x6b-0x7b (16)
|
||||||
|
0x60| 01 | . | [0]: 1 l 0x6b-0x6c (1)
|
||||||
|
0x60| 00 | . | [1]: 0 l 0x6c-0x6d (1)
|
||||||
|
0x60| 00 | . | [2]: 0 l 0x6d-0x6e (1)
|
||||||
|
0x60| 00 | . | [3]: 0 l 0x6e-0x6f (1)
|
||||||
|
0x60| 00| .| [4]: 0 l 0x6f-0x70 (1)
|
||||||
|
0x70|00 |. | [5]: 0 l 0x70-0x71 (1)
|
||||||
|
0x70| 00 | . | [6]: 0 l 0x71-0x72 (1)
|
||||||
|
0x70| 00 | . | [7]: 0 l 0x72-0x73 (1)
|
||||||
|
0x70| 00 | . | [8]: 0 l 0x73-0x74 (1)
|
||||||
|
0x70| 00 | . | [9]: 0 l 0x74-0x75 (1)
|
||||||
|
0x70| 00 | . | [10]: 0 l 0x75-0x76 (1)
|
||||||
|
0x70| 00 | . | [11]: 0 l 0x76-0x77 (1)
|
||||||
|
0x70| 00 | . | [12]: 0 l 0x77-0x78 (1)
|
||||||
|
0x70| 00 | . | [13]: 0 l 0x78-0x79 (1)
|
||||||
|
0x70| 00 | . | [14]: 0 l 0x79-0x7a (1)
|
||||||
|
0x70| 00 | . | [15]: 0 l 0x7a-0x7b (1)
|
||||||
|
| | | v[0:1]: 0x7b-0x7c (1)
|
||||||
|
0x70| 08 | . | [0]: 8 v 0x7b-0x7c (1)
|
||||||
| | | [5]{}: marker 0x7c-0x92 (22)
|
| | | [5]{}: marker 0x7c-0x92 (22)
|
||||||
0x70| ff | . | prefix: raw bits (valid) 0x7c-0x7d (1)
|
0x70| ff | . | prefix: raw bits (valid) 0x7c-0x7d (1)
|
||||||
0x70| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x7d-0x7e (1)
|
0x70| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x7d-0x7e (1)
|
||||||
0x70| 00 14| ..| length: 20 0x7e-0x80 (2)
|
0x70| 00 14| ..| lh: 20 0x7e-0x80 (2)
|
||||||
0x80|10 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................| data: raw bits 0x80-0x92 (18)
|
| | | hs[0:1]: 0x80-0x92 (18)
|
||||||
0x90|00 00 |.. |
|
| | | [0]{}: h 0x80-0x92 (18)
|
||||||
|
0x80|10 |. | tc: 1 0x80-0x80.4 (0.4)
|
||||||
|
0x80|10 |. | th: 0 0x80.4-0x81 (0.4)
|
||||||
|
| | | l[0:16]: 0x81-0x91 (16)
|
||||||
|
0x80| 01 | . | [0]: 1 l 0x81-0x82 (1)
|
||||||
|
0x80| 00 | . | [1]: 0 l 0x82-0x83 (1)
|
||||||
|
0x80| 00 | . | [2]: 0 l 0x83-0x84 (1)
|
||||||
|
0x80| 00 | . | [3]: 0 l 0x84-0x85 (1)
|
||||||
|
0x80| 00 | . | [4]: 0 l 0x85-0x86 (1)
|
||||||
|
0x80| 00 | . | [5]: 0 l 0x86-0x87 (1)
|
||||||
|
0x80| 00 | . | [6]: 0 l 0x87-0x88 (1)
|
||||||
|
0x80| 00 | . | [7]: 0 l 0x88-0x89 (1)
|
||||||
|
0x80| 00 | . | [8]: 0 l 0x89-0x8a (1)
|
||||||
|
0x80| 00 | . | [9]: 0 l 0x8a-0x8b (1)
|
||||||
|
0x80| 00 | . | [10]: 0 l 0x8b-0x8c (1)
|
||||||
|
0x80| 00 | . | [11]: 0 l 0x8c-0x8d (1)
|
||||||
|
0x80| 00 | . | [12]: 0 l 0x8d-0x8e (1)
|
||||||
|
0x80| 00 | . | [13]: 0 l 0x8e-0x8f (1)
|
||||||
|
0x80| 00| .| [14]: 0 l 0x8f-0x90 (1)
|
||||||
|
0x90|00 |. | [15]: 0 l 0x90-0x91 (1)
|
||||||
|
| | | v[0:1]: 0x91-0x92 (1)
|
||||||
|
0x90| 00 | . | [0]: 0 v 0x91-0x92 (1)
|
||||||
| | | [6]{}: marker 0x92-0x9c (10)
|
| | | [6]{}: marker 0x92-0x9c (10)
|
||||||
0x90| ff | . | prefix: raw bits (valid) 0x92-0x93 (1)
|
0x90| ff | . | prefix: raw bits (valid) 0x92-0x93 (1)
|
||||||
0x90| da | . | code: "sos" (218) (Start of scan) 0x93-0x94 (1)
|
0x90| da | . | code: "sos" (218) (Start of scan) 0x93-0x94 (1)
|
||||||
@ -135,4 +177,4 @@ $ fq -d jpeg dv 4x4.jpg
|
|||||||
0x90| 3f bf | ?. | [7]: raw bits entropy_coded_data 0x9c-0x9e (2)
|
0x90| 3f bf | ?. | [7]: raw bits entropy_coded_data 0x9c-0x9e (2)
|
||||||
| | | [8]{}: marker 0x9e-0xa0 (2)
|
| | | [8]{}: marker 0x9e-0xa0 (2)
|
||||||
0x90| ff | . | prefix: raw bits (valid) 0x9e-0x9f (1)
|
0x90| ff | . | prefix: raw bits (valid) 0x9e-0x9f (1)
|
||||||
0x90| d9| .| code: "eoi" (217) (End of image true) 0x9f-0xa0 (1)
|
0x90| d9| .| code: "eoi" (217) (End of image) 0x9f-0xa0 (1)
|
||||||
|
@ -1457,7 +1457,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
|||||||
for i := uint64(0); i < entryCount; i++ {
|
for i := uint64(0); i < entryCount; i++ {
|
||||||
d.FieldStruct("entry", func(d *decode.D) {
|
d.FieldStruct("entry", func(d *decode.D) {
|
||||||
d.FieldU32("sample_count")
|
d.FieldU32("sample_count")
|
||||||
d.FieldU32("group_description_index")
|
d.FieldU32("group_description_index", scalar.UintMapDescription{0: "no group"})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
2
fq.go
2
fq.go
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/wader/fq/pkg/interp"
|
"github.com/wader/fq/pkg/interp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "0.10.0"
|
const version = "0.11.0"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cli.Main(interp.DefaultRegistry, version)
|
cli.Main(interp.DefaultRegistry, version)
|
||||||
|
12
go.mod
12
go.mod
@ -19,7 +19,7 @@ require (
|
|||||||
// bump: gomod-ergochat-readline /github\.com\/ergochat\/readline v(.*)/ https://github.com/ergochat/readline.git|*
|
// bump: gomod-ergochat-readline /github\.com\/ergochat\/readline v(.*)/ https://github.com/ergochat/readline.git|*
|
||||||
// bump: gomod-ergochat-readline command go get -d github.com/ergochat/readline@v$LATEST && go mod tidy
|
// bump: gomod-ergochat-readline command go get -d github.com/ergochat/readline@v$LATEST && go mod tidy
|
||||||
// bump: gomod-ergochat-readline link "Release notes" https://github.com/ergochat/readline/releases/tag/v$LATEST
|
// bump: gomod-ergochat-readline link "Release notes" https://github.com/ergochat/readline/releases/tag/v$LATEST
|
||||||
github.com/ergochat/readline v0.1.0
|
github.com/ergochat/readline v0.1.1
|
||||||
|
|
||||||
// bump: gomod-golang-snappy /github\.com\/golang\/snappy v(.*)/ https://github.com/golang/snappy.git|^0
|
// bump: gomod-golang-snappy /github\.com\/golang\/snappy v(.*)/ https://github.com/golang/snappy.git|^0
|
||||||
// bump: gomod-golang-snappy command go get -d github.com/golang/snappy@v$LATEST && go mod tidy
|
// bump: gomod-golang-snappy command go get -d github.com/golang/snappy@v$LATEST && go mod tidy
|
||||||
@ -48,7 +48,7 @@ require (
|
|||||||
// bump: gomod-golang-x-crypto /golang\.org\/x\/crypto v(.*)/ https://github.com/golang/crypto.git|^0
|
// bump: gomod-golang-x-crypto /golang\.org\/x\/crypto v(.*)/ https://github.com/golang/crypto.git|^0
|
||||||
// bump: gomod-golang-x-crypto command go get -d golang.org/x/crypto@v$LATEST && go mod tidy
|
// bump: gomod-golang-x-crypto command go get -d golang.org/x/crypto@v$LATEST && go mod tidy
|
||||||
// bump: gomod-golang-x-crypto link "Tags" https://github.com/golang/crypto/tags
|
// bump: gomod-golang-x-crypto link "Tags" https://github.com/golang/crypto/tags
|
||||||
golang.org/x/crypto v0.22.0
|
golang.org/x/crypto v0.23.0
|
||||||
|
|
||||||
// has no tags
|
// has no tags
|
||||||
// go get -d golang.org/x/exp@master && go mod tidy
|
// go get -d golang.org/x/exp@master && go mod tidy
|
||||||
@ -57,17 +57,17 @@ require (
|
|||||||
// bump: gomod-golang-x-net /golang\.org\/x\/net v(.*)/ https://github.com/golang/net.git|^0
|
// bump: gomod-golang-x-net /golang\.org\/x\/net v(.*)/ https://github.com/golang/net.git|^0
|
||||||
// bump: gomod-golang-x-net command go get -d golang.org/x/net@v$LATEST && go mod tidy
|
// bump: gomod-golang-x-net command go get -d golang.org/x/net@v$LATEST && go mod tidy
|
||||||
// bump: gomod-golang-x-net link "Tags" https://github.com/golang/net/tags
|
// bump: gomod-golang-x-net link "Tags" https://github.com/golang/net/tags
|
||||||
golang.org/x/net v0.24.0
|
golang.org/x/net v0.25.0
|
||||||
|
|
||||||
// bump: gomod-golang-x-term /golang\.org\/x\/term v(.*)/ https://github.com/golang/term.git|^0
|
// bump: gomod-golang-x-term /golang\.org\/x\/term v(.*)/ https://github.com/golang/term.git|^0
|
||||||
// bump: gomod-golang-x-term command go get -d golang.org/x/term@v$LATEST && go mod tidy
|
// bump: gomod-golang-x-term command go get -d golang.org/x/term@v$LATEST && go mod tidy
|
||||||
// bump: gomod-golang-x-term link "Tags" https://github.com/golang/term/tags
|
// bump: gomod-golang-x-term link "Tags" https://github.com/golang/term/tags
|
||||||
golang.org/x/term v0.19.0
|
golang.org/x/term v0.20.0
|
||||||
|
|
||||||
// bump: gomod-golang/text /golang\.org\/x\/text v(.*)/ https://github.com/golang/text.git|^0
|
// bump: gomod-golang/text /golang\.org\/x\/text v(.*)/ https://github.com/golang/text.git|^0
|
||||||
// bump: gomod-golang/text command go get -d golang.org/x/text@v$LATEST && go mod tidy
|
// bump: gomod-golang/text command go get -d golang.org/x/text@v$LATEST && go mod tidy
|
||||||
// bump: gomod-golang/text link "Source diff $CURRENT..$LATEST" https://github.com/golang/text/compare/v$CURRENT..v$LATEST
|
// bump: gomod-golang/text link "Source diff $CURRENT..$LATEST" https://github.com/golang/text/compare/v$CURRENT..v$LATEST
|
||||||
golang.org/x/text v0.14.0
|
golang.org/x/text v0.15.0
|
||||||
|
|
||||||
// bump: gomod-gopkg.in/yaml.v3 /gopkg\.in\/yaml\.v3 v(.*)/ https://github.com/go-yaml/yaml.git|^3
|
// bump: gomod-gopkg.in/yaml.v3 /gopkg\.in\/yaml\.v3 v(.*)/ https://github.com/go-yaml/yaml.git|^3
|
||||||
// bump: gomod-gopkg.in/yaml.v3 command go get -d gopkg.in/yaml.v3@v$LATEST && go mod tidy
|
// bump: gomod-gopkg.in/yaml.v3 command go get -d gopkg.in/yaml.v3@v$LATEST && go mod tidy
|
||||||
@ -79,6 +79,6 @@ require (
|
|||||||
github.com/itchyny/timefmt-go v0.1.5 // indirect
|
github.com/itchyny/timefmt-go v0.1.5 // indirect
|
||||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||||
golang.org/x/sys v0.19.0 // indirect
|
golang.org/x/sys v0.20.0 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
)
|
)
|
||||||
|
24
go.sum
24
go.sum
@ -2,8 +2,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
|
|||||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
|
github.com/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
|
||||||
github.com/creasty/defaults v1.7.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
|
github.com/creasty/defaults v1.7.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
|
||||||
github.com/ergochat/readline v0.1.0 h1:KEIiAnyH9qGZB4K8oq5mgDcExlEKwmZDcyyocgJiABc=
|
github.com/ergochat/readline v0.1.1 h1:C8Uuo3ybB23GWOt0uxmHbGzKM9owmtXary6Clrj84s0=
|
||||||
github.com/ergochat/readline v0.1.0/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
|
github.com/ergochat/readline v0.1.1/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
|
||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/gomarkdown/markdown v0.0.0-20240328165702-4d01890c35c0 h1:4gjrh/PN2MuWCCElk8/I4OCKRKWCCo2zEct3VKCbibU=
|
github.com/gomarkdown/markdown v0.0.0-20240328165702-4d01890c35c0 h1:4gjrh/PN2MuWCCElk8/I4OCKRKWCCo2zEct3VKCbibU=
|
||||||
@ -25,18 +25,18 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
|
|||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/wader/gojq v0.12.1-0.20240401131232-6c6bc364201a h1:P881Oecjt9FEXrwkGJ6UObJksxejJaF/fKq1ZfXpiVE=
|
github.com/wader/gojq v0.12.1-0.20240401131232-6c6bc364201a h1:P881Oecjt9FEXrwkGJ6UObJksxejJaF/fKq1ZfXpiVE=
|
||||||
github.com/wader/gojq v0.12.1-0.20240401131232-6c6bc364201a/go.mod h1:qVrzkUdnBtJvM4twyRQ6xdziPSnSp35dLm4s/DN2iP4=
|
github.com/wader/gojq v0.12.1-0.20240401131232-6c6bc364201a/go.mod h1:qVrzkUdnBtJvM4twyRQ6xdziPSnSp35dLm4s/DN2iP4=
|
||||||
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
|
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
|
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
|
||||||
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
|
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
|
||||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
|
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||||
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
@ -5,8 +5,6 @@ include "decode";
|
|||||||
|
|
||||||
def intdiv(a; b): _intdiv(a; b);
|
def intdiv(a; b): _intdiv(a; b);
|
||||||
|
|
||||||
def trim: capture("^\\s*(?<str>.*?)\\s*$"; "m").str;
|
|
||||||
|
|
||||||
# does +1 and [:1] as " "*0 is null
|
# does +1 and [:1] as " "*0 is null
|
||||||
def rpad($s; $w): . + ($s * ($w+1-length))[1:];
|
def rpad($s; $w): . + ($s * ($w+1-length))[1:];
|
||||||
|
|
||||||
|
@ -54,9 +54,6 @@ Same as recurse without argument.
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
def help($_): error("help must be alone or last in pipeline. ex: help(length) or ... | help");
|
|
||||||
def help: help(null);
|
|
||||||
|
|
||||||
def _help_format_enrich($arg0; $f; $include_basic):
|
def _help_format_enrich($arg0; $f; $include_basic):
|
||||||
( if $include_basic then
|
( if $include_basic then
|
||||||
.examples +=
|
.examples +=
|
||||||
@ -76,6 +73,9 @@ def _help_format_enrich($arg0; $f; $include_basic):
|
|||||||
end
|
end
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# trailing help gets rewritten to _help_slurp, these are here to catch other variants
|
||||||
|
def help($_): error("help must be alone or last in pipeline. ex: help(length) or ... | help");
|
||||||
|
def help: help(null);
|
||||||
def _help($arg0; $topic):
|
def _help($arg0; $topic):
|
||||||
( $topic
|
( $topic
|
||||||
| if . == "usage" then
|
| if . == "usage" then
|
||||||
@ -236,7 +236,7 @@ def _help($arg0; $topic):
|
|||||||
| ($args | length) as $argc
|
| ($args | length) as $argc
|
||||||
| if $args == null then
|
| if $args == null then
|
||||||
# help
|
# help
|
||||||
( "Type expression to evaluate"
|
( "Type jq expression to evaluate"
|
||||||
, "help(...) Help for topic. Ex: help(mp4), help(\"mp4\")"
|
, "help(...) Help for topic. Ex: help(mp4), help(\"mp4\")"
|
||||||
, "\\t Completion"
|
, "\\t Completion"
|
||||||
, "Up/Down History"
|
, "Up/Down History"
|
||||||
|
2
pkg/interp/testdata/help.fqtest
vendored
2
pkg/interp/testdata/help.fqtest
vendored
@ -1,6 +1,6 @@
|
|||||||
$ fq -ni
|
$ fq -ni
|
||||||
null> help
|
null> help
|
||||||
Type expression to evaluate
|
Type jq expression to evaluate
|
||||||
help(...) Help for topic. Ex: help(mp4), help("mp4")
|
help(...) Help for topic. Ex: help(mp4), help("mp4")
|
||||||
\t Completion
|
\t Completion
|
||||||
Up/Down History
|
Up/Down History
|
||||||
|
Loading…
Reference in New Issue
Block a user