Mattias Wadman
77ab667bfa
interp: Use absolute path in errors
...
Make it easier to find parse error in init.jq etc
2022-02-11 16:34:20 +01:00
Mattias Wadman
26d9650b0e
interp: Refactor radix* into toradix($base)/fromradix($base)
...
There is also toradix($base; $table)/fromradix($base; $table) for custom symbols and bases.
Add radix tests
Part of cleaning up all convert/tranformation functions into to/from*.
Remove number_to_bytes as with better binary support it can be written as:
1234 | tobytes | [.[range(.size)]] and soon as 1234 | tobytes | explode
2022-02-11 01:28:39 +01:00
Mattias Wadman
06245d1295
binary,decode,doc: Rename buffer to binary and add some documentation
...
Rename buffer to binary. Still some work left what to call buffer/binary in decode code.
Document decode value and binary type
Fix proper unit padding for tobytes and add still undocumenated extra padding argument.
Add some additional binary tests
2022-02-08 22:20:28 +01:00
Xentripetal
5b11385ea4
Pull latest from wader
2022-02-07 17:35:33 -06:00
Mattias Wadman
2dc2a24f92
Merge pull request #132 from wader/asn1-frompem-doc
...
asn1_ber: Add more doc and multiple outputs for frompem
2022-02-07 18:04:12 +01:00
Mattias Wadman
0312c92c31
asn1_ber: Add more doc and multiple outputs for frompem
2022-02-07 17:41:05 +01:00
Mattias Wadman
0a1a5610a9
interp: Add missing default opts for tovalue
2022-02-07 17:11:51 +01:00
Mattias Wadman
0829c167cc
asn1_ber: Add decoder
...
Basic support, can also do CER and DER but without any extra validation.
No schema support.
Redo format doc.md usage a bit, now format/<dir>/<format>.md instead.
Related to #20
2022-02-06 22:13:03 +01:00
Mattias Wadman
366f6b185c
interp: Support force decode as -o force=true
2022-02-05 17:24:42 +01:00
Mattias Wadman
7c5215347d
bitio,decode: Refactor bitio usage and make buffer slicing more correct
...
Remove bitio.Buffer layer. bitio.Buffer was a kitchen sink layer with helpers
now it's just a buffer and most functions have been moved to decode instead.
bitio package now only have primitive types and functions simialar to standard
library io and bytes packages.
Make nearly eveything internally use bitio.Bit* interfaces so that slicing work
correctly this will also make it possible to start experimenting with more
complicated silcing helpers, ex things like:
breplace(.header.bitrate; 123) to get a new buffer with bitrate changed.
2022-02-04 21:41:53 +01:00
Mattias Wadman
b66e3287f2
Merge pull request #112 from wader/interp-cleanup-d-alises
...
interp: Cleanup display aliases, now: d, da, dd, dv, ddv
2022-01-29 12:28:46 +01:00
Mattias Wadman
7bc2521938
doc,interp: Add some example usages to cli help
2022-01-29 12:21:51 +01:00
Mattias Wadman
fc0aacb654
interp: Cleanup display aliases, now: d, da, dd, dv, ddv
...
Think it makes sense to have them all start with d.
Also f is often used as function argument name.
2022-01-28 18:25:38 +01:00
Mattias Wadman
b2e5a83860
Merge pull request #110 from wader/doc-improve-use-other-func-notation
...
doc: Use f($a; $b) instead of jq f/2 notation
2022-01-27 10:10:12 +01:00
Mattias Wadman
c52a1a2364
doc: Use f($a; $b) instead of jq f/2 notation
...
Also some general polish
2022-01-27 09:55:45 +01:00
Mattias Wadman
233d86a384
fq: Add arch and os to --version
2022-01-26 18:09:59 +01:00
Mattias Wadman
e792598c69
interp: Add grep_by/1 to recursively match using a filter
...
Refactor other grep functions to use it
2022-01-24 18:26:25 +01:00
Mattias Wadman
bf7a483f87
interp: Fix handling of group decode error from stdin
...
null input to open means stdin but it as also erroneously also used as object key
to store the error.
2022-01-23 12:41:31 +01:00
Xentripetal
788fd0258f
Pull latest from wader
2022-01-13 20:59:56 -06:00
Mattias Wadman
0b0f28e966
cbor: Add decoder
...
Does not decode sematic tag types
Also fixes broken float16 support
Fixes #71
2022-01-12 17:56:03 +01:00
Mattias Wadman
149cb3f45a
interp: Add torepr/0 that converts decode value into what it reptresents
...
Ex: fq -d msgpack torepr file.msgpack
Willoutput the JSON representation of the msgpack
Make per format *_torepr functions internal
2022-01-12 17:33:58 +01:00
Mattias Wadman
05df5a9092
Merge pull request #69 from wader/msgpack
...
msgpack: Add decoder
2022-01-10 21:38:59 +01:00
Mattias Wadman
9770b0046b
repl: Make prompt for array and iter more jqish
...
Really need to refactor script.go some day into a proper parser
2022-01-10 20:02:43 +01:00
Mattias Wadman
a6bf62ce19
msgpack: Add decoder
...
Fixes #25
2022-01-10 19:33:09 +01:00
Mattias Wadman
af8e7efc61
bencode: Add decoder
...
Closes #63
2022-01-10 10:52:14 +01:00
Mattias Wadman
b3a09805a4
interp: Document bit opts funcs and add some error tests
2022-01-09 10:43:07 +01:00
Mattias Wadman
be0ef80c8d
interp,fq: Make bit operators normal functions
...
Uses same rule as jq math functions, 1 arg uses input, more than one all passed as args.
So "bnot 1" -> "1 | bnot", "1 bsl 1" -> "bsl(1; 1)"
Don't think it's worth changing the jq syntax for this and also it could make fq
scripts no compatiblr with other jq tools. Non-10 base number literals are still allowed
but should probably not be used in scripts, only in repl and with cli.
2022-01-09 01:06:36 +01:00
Mattias Wadman
a3cfcd0ad2
interp: Add stderr again for jq compat
...
Also add tests for print* and stderr
2022-01-07 11:30:09 +01:00
Mattias Wadman
628f0f403d
bson: Add decoder
...
Only supports basic types for now
2022-01-06 00:51:37 +01:00
Mattias Wadman
681dbc26b7
elf,ar: Add ar decoder, improved elf decoder
...
Add x86, 386, arm64, arm v6, arm v7 linux elf test files
2022-01-05 22:05:09 +01:00
Mattias Wadman
b6515c8b15
interp: Remove buffer smartness for regexp match functions
...
Just confusing and breaks symbolic grep for decode values (as they are buffers).
To get buffer use tobytes functions intstead.
2022-01-05 21:13:39 +01:00
Mattias Wadman
b9aef39ed4
pcap,pcapng,bsd_loopback_frame: Add decoder, refactor link frame into a group
...
Also fix incorrect struct name s/UDPDatagramIn/UDPPayloadIn/
2022-01-03 21:06:27 +01:00
Xentripetal
7a8e3ca26e
Hook into registry, add codecs
2021-12-28 13:05:10 -06:00
Mattias Wadman
f7c7801bbe
interp: Rework buffer regex support
...
Now all regexp functions should work similar to string version for buffers.
Added scan_toend that works as scan but outputs buffer from match to end of buffer,
useful when trying to decode a format and you dont know or care to limit.
2021-12-17 16:23:44 +01:00
Mattias Wadman
f4f63835dc
interp: Add ._index for values in arrays
2021-12-10 18:19:11 +01:00
Mattias Wadman
6ed2e2e72e
interp: dump: Indicate arrays using jq-syntax
...
Related to #16
2021-12-08 16:24:28 +01:00
Mattias Wadman
9aec91a675
interp: match: Fix issue with regexp meta characters when matching using a buffer
2021-12-04 17:24:43 +01:00
Mattias Wadman
1b7b2f9641
interp: Use gojqextra.NonUpdatableTypeError
2021-12-02 21:41:38 +01:00
Mattias Wadman
01a407a462
interp: Rename s/bufferrange/buffer and cleanup
2021-11-30 21:10:26 +01:00
Mattias Wadman
d1e1cd98c2
decode: Fix walk root depth issue causing dump to indent incorrectly
2021-11-30 12:51:52 +01:00
Mattias Wadman
8d442b82ee
interp: Cleanup stdin reading and add more option tests
2021-11-30 12:25:56 +01:00
Mattias Wadman
f55b1af6ac
inet: Add tcp and ipv4 reassembly
...
Also add tcp_stream and udp_payload to decode content
2021-11-29 18:42:18 +01:00
Mattias Wadman
9f2dddc6e1
interp,gojqextra: Make buffers values even more lazy and error early on non-scalar calls
2021-11-29 14:51:00 +01:00
Mattias Wadman
7b7faaf02b
pcap: Add pcap, pcapng, ether8023, ipv4, udp, udp
2021-11-24 18:13:00 +01:00
Mattias Wadman
e6cb708d38
mpeg: Nicer sym and description
2021-11-22 17:02:07 +01:00
Mattias Wadman
69e4eea920
interp: Better error if format/group is not found
2021-11-22 13:28:18 +01:00
Mattias Wadman
0480a2f722
decode: Some format decode and sub buffer work
2021-11-20 18:56:59 +01:00
Mattias Wadman
9cba69e64d
interp: Use todescription in tests
2021-11-19 11:56:58 +01:00
Mattias Wadman
07b421011f
interp: add topath/0 and make todescription return null if there is none
...
Move out more code from funcs.jq
2021-11-19 11:44:23 +01:00
Mattias Wadman
07c7daaf92
doc: Some rewording
2021-11-19 00:23:04 +01:00
Mattias Wadman
d838d2f613
zip: Add format decoder
2021-11-19 00:22:26 +01:00
Mattias Wadman
f9f866000e
interp,decode: Add force option to ignore asserts
2021-11-16 13:03:56 +01:00
Mattias Wadman
3fafee8559
interp: Clearer help for -d
2021-11-16 08:43:29 +01:00
Mattias Wadman
1b32b42f93
decode: Major decode API refactor
...
Generate more code
More generic and comfortable API
Improve and Update format decoder to new API
Add some more format tests
2021-11-15 21:12:07 +01:00
Mattias Wadman
cc5f405554
interp,format: Update tests after decode refactor/tosym/toactual
2021-11-05 17:29:23 +01:00
Mattias Wadman
6a15625587
interp,decode: Refactor out Scalar from Value and merge Array/Struct into Compound
...
Also add tosym, toactual
2021-11-05 17:29:22 +01:00
Mattias Wadman
93322bc434
interp: Implement format/0 in jq
2021-11-03 10:58:33 +01:00
Mattias Wadman
571bf29ab2
Change project title
2021-11-01 17:47:36 +01:00
Mattias Wadman
58ba84ff93
decode,interp: Add RecoverableErrorer interface instead of enumerate
2021-11-01 17:41:39 +01:00
Mattias Wadman
96cc1283cd
interp: Eval options in jq instead of calling jq from go
...
Simpler and causes less weird performance issues
2021-11-01 17:05:36 +01:00
Mattias Wadman
0660ff08c6
interp: Clear up confusing --rawfile (add a jq alias)
2021-11-01 13:01:05 +01:00
Mattias Wadman
0d693aa59e
interp: Add line between usage and args help
2021-10-30 18:35:21 +02:00
Mattias Wadman
88eade9ab9
ogg: Add flac support
...
Refactor flac_streaminfo and flac_metadata from flac_metadatablocks
Some deocde bitbuf api cleanup
2021-10-29 18:30:16 +02:00
Mattias Wadman
97f7317928
interp: Rework repl prompt code and fix some whitespace issues again
2021-10-28 12:08:19 +02:00
Mattias Wadman
cfdd92215d
interp: Fix prompt issue with format
2021-10-27 16:40:39 +02:00
Mattias Wadman
826c8bd555
interp: Make include abs path work again
2021-10-26 11:02:30 +02:00
Mattias Wadman
b024316289
interp: Remove accidental extra space after path in prompt
2021-10-22 00:17:46 +02:00
Mattias Wadman
eedfd16b40
interp: Replace find with overloaded match that support buffer
2021-10-20 21:16:13 +02:00
Mattias Wadman
16d1f45de1
interp: find buffer should always use ByteRuneReader
...
Fixes grep and bgrep with buffer
2021-10-18 01:34:05 +02:00
Mattias Wadman
d6d94842b5
interp: Remove --options, probably just confusing
2021-10-18 00:59:35 +02:00
Mattias Wadman
7f36f703dd
Add to/bytes/bits[range]
2021-10-17 14:43:37 +02:00
Mattias Wadman
7298a4cd8d
interp: Add buffer match support to find and grep
2021-10-17 01:26:30 +02:00
Mattias Wadman
e86b45bd1a
Add *grep/1/2 and find/1/2
2021-10-13 01:27:04 +02:00
Mattias Wadman
879bb569f3
interp: Correctly check if _decode_value, add more has/1 tests
2021-10-07 13:35:48 +02:00
Mattias Wadman
691688022f
fqtest: Refactor our script part to own package
...
Hopefully can be reused for docs generation
2021-10-06 18:49:03 +02:00
Mattias Wadman
1c3c65b191
interp: Rework buffer, still confusing
2021-10-05 22:26:05 +02:00
Mattias Wadman
618c1ea79f
interp: Refactor/Rename BufferView
...
TODO: fix bit level dump again
2021-09-28 01:46:32 +02:00
Mattias Wadman
f1fcbe5dfb
interp: Make has/1 work for _ext keys
2021-09-28 01:45:27 +02:00
Mattias Wadman
ab8080f495
make: Reorganize test targets
...
Fix whitespaces in tests
2021-09-27 22:47:17 +02:00
Mattias Wadman
cf26b1fc8e
interp: _readline: Use _repeat_break, add test
2021-09-23 14:39:03 +02:00
Mattias Wadman
110c86b959
interp: Fix broken dynamic width/height
...
Refactor options to fixed/dynamic and just use stack
Added support for env in fqtest readlines
2021-09-22 18:18:57 +02:00
Mattias Wadman
6ce4ba919b
interp: Use snake_case for all options
2021-09-22 00:32:57 +02:00
Mattias Wadman
ed21f36b23
mp3_frame: Rename samples_per_frame to sample_count
2021-09-20 18:54:20 +02:00
Mattias Wadman
90c19c6cc1
make,test: Move testjq to own script and reuse fq binary
...
Remove version from --help for now
2021-09-19 11:50:41 +02:00
Mattias Wadman
31d7611f55
fqtest: Add env support and isterminal/width/height support
2021-09-19 02:17:31 +02:00
Mattias Wadman
93fd097b53
cli: Add -M -C support and default to color if tty
2021-09-19 01:19:48 +02:00
Mattias Wadman
1fe5d95307
interp: Some better naming and typos
2021-09-18 10:47:43 +02:00
Mattias Wadman
797bd4d652
flac: Refactor flac_metadatablock into flac_metadatablocks
...
metadatablocks are not really used alone
2021-09-17 15:46:13 +02:00
Mattias Wadman
ee972f490d
dump: Add ascii header
2021-09-16 22:40:03 +02:00
Mattias Wadman
6ee7977c53
decode,format: Allow root array
2021-09-16 16:27:47 +02:00
Mattias Wadman
8277b79c21
gojq: Update fq fork, support JQValue alt //
2021-09-16 00:46:25 +02:00
Mattias Wadman
26c594feb1
input: make -R mimic jq on io error
2021-09-13 12:12:34 +02:00
Mattias Wadman
dcceaa4b35
repl: Fix help and error message a bit
2021-09-12 13:08:56 +02:00
Mattias Wadman
c9777aaded
repl: completion in jq
2021-09-12 13:08:56 +02:00
Mattias Wadman
44d8b66a8e
repl: Give error if repl is used in non-repl mode
2021-09-12 13:08:56 +02:00
Mattias Wadman
ec98fd315a
cli: Make --argjson and --decode-file error similar
2021-09-12 13:08:56 +02:00
Mattias Wadman
d350971fa2
cli: Add --decode-file VAR PATH support
2021-09-12 13:08:55 +02:00
Mattias Wadman
f5ffd32096
cli: Implement --arg, --argjson and --rawfile
2021-09-12 13:08:55 +02:00
Mattias Wadman
48517c7c60
cli: Unbreak part of completion
2021-09-12 13:08:55 +02:00
Mattias Wadman
f8e5944f91
dump,json: Properly figure if compound or not
2021-09-12 13:08:55 +02:00