1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 13:22:58 +03:00

gojq: Update rebased fq fork

Fix tostring for non-string JQValue:s, is now JSON
Update EOF error
This commit is contained in:
Mattias Wadman 2022-06-01 17:27:33 +02:00
parent 783387ed8a
commit c1a0cda5a8
9 changed files with 12 additions and 13 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require (
// fork of github.com/itchyny/gojq, see github.com/wader/gojq fq branch
github.com/wader/gojq v0.12.1-0.20220523192338-6ad601ba3ad4
github.com/wader/gojq v0.12.1-0.20220601152154-922ce7140f4e
// fork of github.com/chzyer/readline, see github.com/wader/readline fq branch
github.com/wader/readline v0.0.0-20220519145246-cc6b808370a7
)

9
go.sum
View File

@ -8,7 +8,7 @@ github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo
github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU=
github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
@ -17,8 +17,9 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/wader/gojq v0.12.1-0.20220523192338-6ad601ba3ad4 h1:tVeOphgXlGRx0s92DZirhEXUI+6PymV/aHUWFx7ZCcQ=
github.com/wader/gojq v0.12.1-0.20220523192338-6ad601ba3ad4/go.mod h1:Pq2wrnwmiGxsaT62vOTEXkH3J3tI81VHJ2K2ZePP6oI=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/wader/gojq v0.12.1-0.20220601152154-922ce7140f4e h1:zOydbLM4CuHb2JWgmryiWaZI+zEkN03Iq6CGUrcjaZY=
github.com/wader/gojq v0.12.1-0.20220601152154-922ce7140f4e/go.mod h1:S7eYehcjyRcC4OgN3loG0+3Ozty0OaJZ8eEXVXvf+0o=
github.com/wader/readline v0.0.0-20220519145246-cc6b808370a7 h1:dzXHW2D21gXwLUYEcauxccmtfUVkOoB/zJ9pqX00FiA=
github.com/wader/readline v0.0.0-20220519145246-cc6b808370a7/go.mod h1:7FWZ5rXtHk67PmaVWEAUAVNaqdEqq3H6T75m+sPlx+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -36,7 +37,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -48,6 +48,5 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -1,4 +1,4 @@
$ fq -n '"ff7f00" | frombase64 | ., (("", "std", "url", "rawstd", "rawurl") as $e | tobase64({encoding: $e}) | ., frombase64({encoding: $e})
exitcode: 3
stderr:
error: arg:1:132: unexpected token <EOF>
error: arg:1:131: unexpected EOF

View File

@ -19,7 +19,7 @@ error: arg: function not defined: invalid/0
$ fq -n "("
exitcode: 3
stderr:
error: arg:1:2: unexpected token <EOF>
error: arg:1:1: unexpected EOF
$ fq . non-existing
exitcode: 2
stderr:

View File

@ -58,7 +58,7 @@ error: non-existing: no such file or directory
$ fq -d raw '(' a b c
exitcode: 3
stderr:
error: arg:1:2: unexpected token <EOF>
error: arg:1:1: unexpected EOF
$ fq -d raw bla a b c
exitcode: 3
stderr:

View File

@ -127,7 +127,7 @@ mp3> .headers | type
mp3> .headers | tonumber
error: tonumber cannot be applied to: array
mp3> .headers | tostring
error: tostring cannot be applied to: array
"[{\"flags\":{\"experimental_indicator\":false,\"extended_header\":false,\"unsynchronisation\":false,\"unused\":0},\"frames\":[{\"flags\":{\"compression\":false,\"data_length_indicator\":false,\"encryption\":false,\"file_alter_preservation\":false,\"grouping_identity\":false,\"read_only\":false,\"tag_alter_preservation\":false,\"unsync\":false,\"unused0\":0,\"unused1\":0,\"unused2\":0},\"id\":\"TSSE\",\"size\":15,\"text\":\"Lavf58.45.100\",\"text_encoding\":\"utf8\"}],\"magic\":\"ID3\",\"padding\":\"\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\",\"revision\":0,\"size\":35,\"version\":4}]"
mp3> .headers + ""
error: cannot add: array ([{"flags":{"experimental_ ...]) and string ("")
mp3> .headers + 1

View File

@ -45,7 +45,7 @@ json> (.) | type
json> (.) | tonumber
error: tonumber cannot be applied to: array
json> (.) | tostring
error: tostring cannot be applied to: array
"[]"
json> (.) + ""
error: cannot add: array ([]) and string ("")
json> (.) + 1

View File

@ -35,7 +35,7 @@ json> (.) | type
json> (.) | tonumber
error: tonumber cannot be applied to: object
json> (.) | tostring
error: tostring cannot be applied to: object
"{}"
json> (.) + ""
error: cannot add: object ({}) and string ("")
json> (.) + 1

View File

@ -48,7 +48,7 @@ mp3> .headers[0].flags | type
mp3> .headers[0].flags | tonumber
error: tonumber cannot be applied to: object
mp3> .headers[0].flags | tostring
error: tostring cannot be applied to: object
"{\"experimental_indicator\":false,\"extended_header\":false,\"unsynchronisation\":false,\"unused\":0}"
mp3> .headers[0].flags + ""
error: cannot add: object ({"experimental_indicator" ...}) and string ("")
mp3> .headers[0].flags + 1