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

Compare commits

...

42 Commits

Author SHA1 Message Date
Mattias Wadman
4adfb9a89c
Merge 5c8f088328 into 943743dbaf 2024-05-21 15:46:50 +02:00
Mattias Wadman
943743dbaf
Merge pull request #949 from wader/bump-make-golangci-lint-1.58.2
Update make-golangci-lint to 1.58.2 from 1.58.1
2024-05-20 22:16:07 +02:00
Mattias Wadman
1b85ae622b
Merge pull request #950 from wader/bump-github-golangci-lint-1.58.2
Update github-golangci-lint to 1.58.2 from 1.58.1
2024-05-20 22:16:01 +02:00
bump
f6d7235449 Update github-golangci-lint to 1.58.2 from 1.58.1
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.2
2024-05-20 16:04:14 +00:00
bump
aef47df26a Update make-golangci-lint to 1.58.2 from 1.58.1
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.2
2024-05-20 16:04:10 +00:00
Mattias Wadman
1ec9748046
Merge pull request #947 from wader/bump-make-golangci-lint-1.58.1
Update make-golangci-lint to 1.58.1 from 1.58.0
2024-05-09 18:12:49 +02:00
Mattias Wadman
2e5514fc50
Merge pull request #948 from wader/bump-github-golangci-lint-1.58.1
Update github-golangci-lint to 1.58.1 from 1.58.0
2024-05-09 18:12:44 +02:00
bump
a59ba2a2fa Update github-golangci-lint to 1.58.1 from 1.58.0
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.1
2024-05-09 16:03:55 +00:00
bump
7714fcf423 Update make-golangci-lint to 1.58.1 from 1.58.0
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.1
2024-05-09 16:03:52 +00:00
Mattias Wadman
544cf4cc09
Merge pull request #945 from wader/bump-docker-golang-1.22.3
Update docker-golang to 1.22.3 from 1.22.2
2024-05-09 00:01:16 +02:00
Mattias Wadman
25ad5f1c8f
Merge pull request #946 from wader/bump-github-go-version-1.22.3
Update github-go-version to 1.22.3 from 1.22.2
2024-05-09 00:00:41 +02:00
bump
9ff7da12a7 Update github-go-version to 1.22.3 from 1.22.2 2024-05-08 16:03:46 +00:00
bump
94cfbc670c Update docker-golang to 1.22.3 from 1.22.2 2024-05-08 16:03:44 +00:00
Mattias Wadman
163b3b609c
Merge pull request #944 from wader/bump-gomod-golang-x-net-0.25.0
Update gomod-golang-x-net to 0.25.0 from 0.24.0
2024-05-07 18:31:45 +02:00
bump
cabb67e8ab Update gomod-golang-x-net to 0.25.0 from 0.24.0
Tags https://github.com/golang/net/tags
2024-05-07 16:03:50 +00:00
Mattias Wadman
64df8bdbf5
Merge pull request #943 from wader/bump-gomod-golang-x-crypto-0.23.0
Update gomod-golang-x-crypto to 0.23.0 from 0.22.0
2024-05-06 19:16:07 +02:00
Mattias Wadman
481ac91880
Merge pull request #942 from wader/bump-gomod-ergochat-readline-0.1.1
Update gomod-ergochat-readline to 0.1.1 from 0.1.0
2024-05-06 19:15:51 +02:00
bump
14ada50806 Update gomod-golang-x-crypto to 0.23.0 from 0.22.0
Tags https://github.com/golang/crypto/tags
2024-05-06 16:04:45 +00:00
bump
12f332064c Update gomod-ergochat-readline to 0.1.1 from 0.1.0
Release notes https://github.com/ergochat/readline/releases/tag/v0.1.1
2024-05-06 16:04:43 +00:00
Mattias Wadman
0ff3e53c5f
Merge pull request #941 from wader/bump-gomod-golang-x-term-0.20.0
Update gomod-golang-x-term to 0.20.0 from 0.19.0
2024-05-05 18:16:15 +02:00
bump
586cf142e5 Update gomod-golang-x-term to 0.20.0 from 0.19.0
Tags https://github.com/golang/term/tags
2024-05-05 16:03:41 +00:00
Mattias Wadman
fb20db5eb7
Merge pull request #937 from wader/bump-make-golangci-lint-1.58.0
Update make-golangci-lint to 1.58.0 from 1.57.2
2024-05-04 18:15:24 +02:00
Mattias Wadman
48868bd4ee
Merge pull request #939 from wader/bump-github-golangci-lint-1.58.0
Update github-golangci-lint to 1.58.0 from 1.57.2
2024-05-04 18:12:55 +02:00
Mattias Wadman
c5c8b75c56
Merge pull request #938 from wader/bump-gomod-golang/text-0.15.0
Update gomod-golang/text to 0.15.0 from 0.14.0
2024-05-04 18:12:01 +02:00
bump
a5de74cd23 Update github-golangci-lint to 1.58.0 from 1.57.2
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.0
2024-05-04 16:03:51 +00:00
bump
42730d7586 Update gomod-golang/text to 0.15.0 from 0.14.0
Source diff 0.14.0..0.15.0 https://github.com/golang/text/compare/v0.14.0..v0.15.0
2024-05-04 16:03:49 +00:00
bump
3a683b64f8 Update make-golangci-lint to 1.58.0 from 1.57.2
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.58.0
2024-05-04 16:03:46 +00:00
Mattias Wadman
496849daa5
Merge pull request #936 from wader/update-docs
doc: Cleanup and improve texts a bit
2024-04-30 14:25:36 +02:00
Mattias Wadman
ebf063d1c0 doc: Cleanup and improve texts a bit 2024-04-30 14:16:13 +02:00
Mattias Wadman
b8eec4078f
Merge pull request #934 from matmat/dht-patch
jpeg: Add parsing of DHT parameters
2024-04-25 13:29:44 +02:00
Mattias Iko Mattsson
6e13b4b550 jpeg: Add parsing of DHT parameters 2024-04-25 13:17:08 +02:00
Mattias Wadman
9eee65072f
Merge pull request #935 from wader/ignore-so-dotdotdot-works
build,test: Ignore some files to make ./... work
2024-04-21 11:30:37 +02:00
Mattias Wadman
6db6a54d13 build,test: Ignore some files to make ./... work 2024-04-21 09:50:02 +02:00
Mattias Wadman
08ced4515f
Merge pull request #933 from wader/native-trim
fq: Use trim from gojq
2024-04-19 18:23:15 +02:00
Mattias Wadman
6059b9ee1b fq: Use trim from gojq 2024-04-19 18:09:00 +02:00
Mattias Wadman
f746dab7b2
Merge pull request #932 from wader/jpeg-fix-weird-eoi-desc
jpeg: Fix EOI description
2024-04-19 15:34:52 +02:00
Mattias Wadman
b482556025 jpeg: Fix EOI description 2024-04-19 15:26:10 +02:00
Mattias Wadman
4674060dfe
Merge pull request #931 from wader/goreleaser-update
goreleaser: Update action and fix deprecation warning
2024-04-16 11:44:57 +02:00
Mattias Wadman
ad2c032c7e goreleaser: Update action and fix deprecation warning 2024-04-16 11:12:36 +02:00
Mattias Wadman
d30755b06e
Merge pull request #930 from wader/release-0.11.0
fq: Release 0.11.0
2024-04-14 12:51:38 +02:00
Mattias Wadman
2b12258eba jq: Release 0.11.0 2024-04-14 12:41:42 +02:00
Mattias Wadman
5c8f088328 mp4: sbgp: Add not group description for group_description_index 0 2024-03-27 18:24:39 +01:00
21 changed files with 219 additions and 60 deletions

View File

@ -7,7 +7,7 @@ on:
pull_request:
env:
GOLANGCILINT_VERSION: "1.57.2"
GOLANGCILINT_VERSION: "1.58.2"
jobs:
lint:
@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.22.2"
go-version: "1.22.3"
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
with:
@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.22.2"
go-version: "1.22.3"
- name: Test
env:
GOARCH: ${{ matrix.goarch }}

View File

@ -15,8 +15,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.22.2"
- uses: goreleaser/goreleaser-action@v2
go-version: "1.22.3"
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest

View File

@ -59,7 +59,7 @@ brews:
repository:
owner: wader
name: homebrew-tap
folder: Formula
directory: Formula
homepage: https://github.com/wader/fq
description: jq for binary formats
license: MIT

View File

@ -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
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
```
- `hevc_sps` Fix some incorrect profile_tier_level decoding. #829
- `html` Fix issue parsing elements including SOLIDUS "/". #870
- Upstream issue https://github.com/golang/go/issues/63402

View File

@ -1,5 +1,5 @@
# 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
RUN \

View File

@ -61,7 +61,7 @@ gogenerate: always
lint: always
# 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
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
go run github.com/kisielk/godepgraph@latest github.com/wader/fq | dot -Tsvg -o godepgraph.svg

View File

@ -2,25 +2,23 @@
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)
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).
### 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.
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!
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.
### Goals
- Make binaries accessible, queryable and sliceable.
- Make binaries more accessible, queryable and sliceable.
- Nested formats and bit-oriented decoding.
- Quick and comfortable CLI tool.
- 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.
To install directly from git repository (no clone needed):
To install directly from git repository (no git clone needed):
```sh
# build and install latest release
go install github.com/wader/fq@latest
@ -267,10 +265,6 @@ go build -o fq .
make test fq
```
## TODO and ideas
See [TODO.md](doc/TODO.md)
## Development and adding a new decoder
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.
- [Data Format Description Language (DFDL)](https://en.wikipedia.org/wiki/Data_Format_Description_Language).
## TODO and ideas
See [TODO.md](doc/TODO.md)
## License
`fq` is distributed under the terms of the MIT License.

View File

@ -1,3 +1,5 @@
//go:build exclude
// tool to convert go fuzz input files to bytes
// Usage: cat format/testdata/fuzz/FuzzFormats/144bde49b40c90fd05d302ec90b6ddb2b6d6aea553bad520a8b954797e40fe72 | go run dev/fuzzbytes.go | go run .
package main

View File

@ -1,3 +1,5 @@
//go:build exclude
package main
import (

View File

@ -236,8 +236,8 @@ make test
go test ./...
# run all tests for one format
go test -run TestFormats/mp4 ./format/
# update all actual outputs in tests
go test ./... -update
# update all expected outputs for tests
go test ./pkg/interp ./format -update
# update actual output for specific tests
go run ./format -run TestFormats/elf -update
# color diff

View File

@ -1,3 +1,9 @@
//go:build exclude
package bts2022
import "github.com/wader/fq/pkg/decode"
func avcHdrParameters(d *decode.D) {
cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UAdd(1))
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("dpb_output_delay_length", scalar.UAdd(1))
d.FieldU5("time_offset_length")
}
}

View File

@ -1,3 +1,7 @@
//go:build exclude
package bts2022
func decode(d *decode.D) any {
d.FieldArray("headers", func(d *decode.D) {
for !d.End() {

View File

@ -124,7 +124,7 @@ var markers = scalar.UintMap{
RST6: {Sym: "rst6", Description: "Restart with modulo 8 count 6"},
RST7: {Sym: "rst7", Description: "Restart with modulo 8 count 7"},
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"},
DQT: {Sym: "dqt", Description: "Define quantization table(s)"},
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:
inECD = true
case TEM:

View File

@ -109,15 +109,57 @@ $ fq -d jpeg dv 4x4.jpg
| | | [4]{}: marker 0x66-0x7c (22)
0x60| ff | . | prefix: raw bits (valid) 0x66-0x67 (1)
0x60| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x67-0x68 (1)
0x60| 00 14 | .. | length: 20 0x68-0x6a (2)
0x60| 00 01 00 00 00 00| ......| data: raw bits 0x6a-0x7c (18)
0x70|00 00 00 00 00 00 00 00 00 00 00 08 |............ |
0x60| 00 14 | .. | lh: 20 0x68-0x6a (2)
| | | hs[0:1]: 0x6a-0x7c (18)
| | | [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)
0x70| ff | . | prefix: raw bits (valid) 0x7c-0x7d (1)
0x70| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x7d-0x7e (1)
0x70| 00 14| ..| length: 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)
0x90|00 00 |.. |
0x70| 00 14| ..| lh: 20 0x7e-0x80 (2)
| | | hs[0:1]: 0x80-0x92 (18)
| | | [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)
0x90| ff | . | prefix: raw bits (valid) 0x92-0x93 (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)
| | | [8]{}: marker 0x9e-0xa0 (2)
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)

View File

@ -1457,7 +1457,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
for i := uint64(0); i < entryCount; i++ {
d.FieldStruct("entry", func(d *decode.D) {
d.FieldU32("sample_count")
d.FieldU32("group_description_index")
d.FieldU32("group_description_index", scalar.UintMapDescription{0: "no group"})
})
}
})

2
fq.go
View File

@ -6,7 +6,7 @@ import (
"github.com/wader/fq/pkg/interp"
)
const version = "0.10.0"
const version = "0.11.0"
func main() {
cli.Main(interp.DefaultRegistry, version)

12
go.mod
View File

@ -19,7 +19,7 @@ require (
// 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 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 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 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
golang.org/x/crypto v0.22.0
golang.org/x/crypto v0.23.0
// has no tags
// 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 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
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 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
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 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
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 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/mitchellh/reflectwalk v1.0.2 // 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
)

24
go.sum
View File

@ -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/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
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.0/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
github.com/ergochat/readline v0.1.1 h1:C8Uuo3ybB23GWOt0uxmHbGzKM9owmtXary6Clrj84s0=
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/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
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/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=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
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/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
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 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -5,8 +5,6 @@ include "decode";
def intdiv(a; b): _intdiv(a; b);
def trim: capture("^\\s*(?<str>.*?)\\s*$"; "m").str;
# does +1 and [:1] as " "*0 is null
def rpad($s; $w): . + ($s * ($w+1-length))[1:];

View File

@ -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):
( if $include_basic then
.examples +=
@ -76,6 +73,9 @@ def _help_format_enrich($arg0; $f; $include_basic):
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):
( $topic
| if . == "usage" then
@ -236,7 +236,7 @@ def _help($arg0; $topic):
| ($args | length) as $argc
| if $args == null then
# help
( "Type expression to evaluate"
( "Type jq expression to evaluate"
, "help(...) Help for topic. Ex: help(mp4), help(\"mp4\")"
, "\\t Completion"
, "Up/Down History"

View File

@ -1,6 +1,6 @@
$ fq -ni
null> help
Type expression to evaluate
Type jq expression to evaluate
help(...) Help for topic. Ex: help(mp4), help("mp4")
\t Completion
Up/Down History