@port-labs/jq-node-bindings 1.0.4 → 1.1.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +12 -0
- package/configure +6 -5
- package/deps/jq/.claude/settings.local.json +7 -0
- package/deps/jq/.gitattributes +1 -3
- package/deps/jq/AUTHORS +55 -1
- package/deps/jq/COPYING +40 -0
- package/deps/jq/Makefile.am +40 -36
- package/deps/jq/NEWS.md +277 -2
- package/deps/jq/README.md +23 -5
- package/deps/jq/compile-ios.sh +1 -1
- package/deps/jq/config/m4/check-math-func.m4 +2 -2
- package/deps/jq/config/m4/find-func-no-libs2.m4 +3 -3
- package/deps/jq/configure.ac +10 -18
- package/deps/jq/docs/Pipfile.lock +368 -313
- package/deps/jq/docs/README.md +3 -4
- package/deps/jq/docs/build_manpage.py +1 -1
- package/deps/jq/docs/build_mantests.py +1 -1
- package/deps/jq/docs/build_website.py +1 -8
- package/deps/jq/docs/content/download/default.yml +49 -9
- package/deps/jq/docs/content/index.yml +9 -0
- package/deps/jq/docs/content/manual/{manual.yml → dev/manual.yml} +218 -61
- package/deps/jq/docs/content/manual/v1.3/manual.yml +0 -5
- package/deps/jq/docs/content/manual/v1.4/manual.yml +0 -5
- package/deps/jq/docs/content/manual/v1.5/manual.yml +3 -8
- package/deps/jq/docs/content/manual/v1.6/manual.yml +3 -8
- package/deps/jq/docs/content/manual/v1.7/manual.yml +499 -500
- package/deps/jq/docs/content/manual/v1.8/manual.yml +3858 -0
- package/deps/jq/docs/content/tutorial/default.yml +3 -3
- package/deps/jq/docs/manual_schema.yml +0 -3
- package/deps/jq/docs/public/CNAME +1 -0
- package/deps/jq/docs/templates/index.html.j2 +10 -10
- package/deps/jq/docs/templates/manual.html.j2 +14 -3
- package/deps/jq/docs/templates/shared/_head.html.j2 +8 -3
- package/deps/jq/docs/templates/shared/_navbar.html.j2 +4 -4
- package/deps/jq/jq.1.prebuilt +219 -44
- package/deps/jq/jq.spec +2 -2
- package/deps/jq/libjq.pc.in +1 -1
- package/deps/jq/scripts/version +1 -1
- package/deps/jq/sig/v1.7.1/jq-1.7.1.tar.gz.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-1.7.1.zip.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-amd64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-arm64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-armel.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-armhf.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-i386.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mips.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mips64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mips64el.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mips64r6.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mips64r6el.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mipsel.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mipsr6.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-mipsr6el.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-powerpc.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-ppc64el.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-riscv64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux-s390x.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-linux64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-macos-amd64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-macos-arm64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-osx-amd64.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-win64.exe.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-windows-amd64.exe.asc +16 -0
- package/deps/jq/sig/v1.7.1/jq-windows-i386.exe.asc +16 -0
- package/deps/jq/sig/v1.7.1/sha256sum.txt +26 -0
- package/deps/jq/sig/v1.8.0/jq-1.8.0.tar.gz.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-1.8.0.zip.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-amd64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-arm64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-armel.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-armhf.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-i386.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mips.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mips64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mips64el.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mips64r6.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mips64r6el.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mipsel.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mipsr6.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-mipsr6el.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-powerpc.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-ppc64el.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-riscv64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux-s390x.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-linux64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-macos-amd64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-macos-arm64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-osx-amd64.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-win64.exe.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-windows-amd64.exe.asc +16 -0
- package/deps/jq/sig/v1.8.0/jq-windows-i386.exe.asc +16 -0
- package/deps/jq/sig/v1.8.0/sha256sum.txt +26 -0
- package/deps/jq/src/builtin.c +446 -271
- package/deps/jq/src/builtin.jq +25 -60
- package/deps/jq/src/bytecode.h +8 -3
- package/deps/jq/src/compile.c +22 -43
- package/deps/jq/src/compile.h +1 -1
- package/deps/jq/src/execute.c +20 -25
- package/deps/jq/src/jq_test.c +113 -44
- package/deps/jq/src/jv.c +134 -42
- package/deps/jq/src/jv.h +10 -3
- package/deps/jq/src/jv_alloc.c +8 -5
- package/deps/jq/src/jv_alloc.h +0 -1
- package/deps/jq/src/jv_aux.c +41 -8
- package/deps/jq/src/jv_dtoa.c +4 -12
- package/deps/jq/src/jv_dtoa_tsd.c +5 -4
- package/deps/jq/src/jv_dtoa_tsd.h +1 -1
- package/deps/jq/src/jv_parse.c +5 -3
- package/deps/jq/src/jv_print.c +87 -65
- package/deps/jq/src/jv_unicode.c +18 -0
- package/deps/jq/src/jv_unicode.h +2 -0
- package/deps/jq/src/lexer.c +303 -278
- package/deps/jq/src/lexer.h +5 -4
- package/deps/jq/src/lexer.l +8 -2
- package/deps/jq/src/libm.h +15 -5
- package/deps/jq/src/linker.c +6 -4
- package/deps/jq/src/locfile.c +12 -12
- package/deps/jq/src/main.c +204 -270
- package/deps/jq/src/parser.c +1105 -1273
- package/deps/jq/src/parser.y +149 -181
- package/deps/jq/src/util.c +46 -48
- package/deps/jq/src/util.h +1 -1
- package/deps/jq/tests/base64.test +12 -0
- package/deps/jq/tests/jq.test +429 -37
- package/deps/jq/tests/jq_fuzz_load_file.c +1 -0
- package/deps/jq/tests/man.test +46 -13
- package/deps/jq/tests/manonig.test +13 -0
- package/deps/jq/tests/onig.test +40 -2
- package/deps/jq/tests/optional.test +4 -12
- package/deps/jq/tests/setup +5 -1
- package/deps/jq/tests/shtest +358 -130
- package/deps/jq/tests/uri.test +38 -0
- package/deps/jq/tests/uritest +5 -0
- package/deps/jq/{src → vendor}/decNumber/decBasic.c +1 -1
- package/deps/jq/{src → vendor}/decNumber/decCommon.c +1 -1
- package/deps/jq/{src → vendor}/decNumber/decNumber.c +4 -4
- package/deps/jq/{modules → vendor}/oniguruma/CMakeLists.txt +5 -3
- package/deps/jq/{modules → vendor}/oniguruma/HISTORY +45 -7
- package/deps/jq/{modules → vendor}/oniguruma/Makefile.am +1 -1
- package/deps/jq/{modules → vendor}/oniguruma/README.md +10 -23
- package/deps/jq/{modules → vendor}/oniguruma/compile +29 -13
- package/deps/jq/{modules → vendor}/oniguruma/config.guess +91 -27
- package/deps/jq/{modules → vendor}/oniguruma/config.sub +716 -242
- package/deps/jq/{modules → vendor}/oniguruma/configure.ac +2 -2
- package/deps/jq/{modules → vendor}/oniguruma/depcomp +10 -9
- package/deps/jq/{modules → vendor}/oniguruma/doc/API +3 -1
- package/deps/jq/{modules → vendor}/oniguruma/doc/API.ja +3 -1
- package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.BUILTIN +10 -1
- package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.BUILTIN.ja +9 -1
- package/deps/jq/{modules → vendor}/oniguruma/doc/RE +12 -13
- package/deps/jq/{modules → vendor}/oniguruma/doc/RE.ja +12 -13
- package/deps/jq/{modules → vendor}/oniguruma/doc/SYNTAX.md +202 -167
- package/deps/jq/{modules → vendor}/oniguruma/doc/UNICODE_PROPERTIES +33 -1
- package/deps/jq/vendor/oniguruma/doc/onig_syn_md.c +667 -0
- package/deps/jq/{modules → vendor}/oniguruma/harnesses/base.c +1 -1
- package/deps/jq/{modules → vendor}/oniguruma/install-sh +9 -9
- package/deps/jq/{modules → vendor}/oniguruma/missing +50 -29
- package/deps/jq/{modules → vendor}/oniguruma/sample/callback_each_match.c +1 -3
- package/deps/jq/vendor/oniguruma/sbom.cdx.json +44 -0
- package/deps/jq/{modules → vendor}/oniguruma/src/ascii.c +4 -1
- package/deps/jq/{modules → vendor}/oniguruma/src/gperf_fold_key_conv.py +4 -4
- package/deps/jq/{modules → vendor}/oniguruma/src/gperf_unfold_key_conv.py +4 -4
- package/deps/jq/vendor/oniguruma/src/make_unicode_egcb.sh +7 -0
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_egcb_data.py +20 -19
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_fold.sh +5 -5
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_fold_data.py +37 -37
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_property.sh +2 -2
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_property_data.py +66 -65
- package/deps/jq/vendor/oniguruma/src/make_unicode_wb.sh +7 -0
- package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_wb_data.py +20 -19
- package/deps/jq/{modules → vendor}/oniguruma/src/oniguruma.h +6 -3
- package/deps/jq/{modules → vendor}/oniguruma/src/regcomp.c +14 -6
- package/deps/jq/{modules → vendor}/oniguruma/src/regerror.c +2 -2
- package/deps/jq/{modules → vendor}/oniguruma/src/regexec.c +85 -14
- package/deps/jq/{modules → vendor}/oniguruma/src/regint.h +17 -4
- package/deps/jq/{modules → vendor}/oniguruma/src/regparse.c +115 -27
- package/deps/jq/{modules → vendor}/oniguruma/src/regsyntax.c +10 -7
- package/deps/jq/{modules → vendor}/oniguruma/src/st.c +49 -75
- package/deps/jq/{modules → vendor}/oniguruma/src/st.h +3 -10
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_egcb_data.c +54 -49
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold1_key.c +1567 -1507
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold2_key.c +1 -1
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold3_key.c +1 -1
- package/deps/jq/vendor/oniguruma/src/unicode_fold_data.c +1619 -0
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_property_data.c +5520 -4178
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_property_data_posix.c +239 -83
- package/deps/jq/vendor/oniguruma/src/unicode_unfold_key.c +3497 -0
- package/deps/jq/{modules → vendor}/oniguruma/src/unicode_wb_data.c +51 -19
- package/deps/jq/{modules → vendor}/oniguruma/src/utf16_be.c +3 -2
- package/deps/jq/{modules → vendor}/oniguruma/src/utf16_le.c +3 -2
- package/deps/jq/{modules → vendor}/oniguruma/test/test_back.c +3 -3
- package/deps/jq/{modules → vendor}/oniguruma/test/test_options.c +2 -2
- package/deps/jq/{modules → vendor}/oniguruma/test/test_syntax.c +54 -2
- package/deps/jq/{modules → vendor}/oniguruma/test/test_utf8.c +19 -5
- package/deps/jq/{modules → vendor}/oniguruma/test/testc.c +1 -1
- package/deps/jq/{modules → vendor}/oniguruma/test/testp.c +1 -1
- package/deps/jq/{modules → vendor}/oniguruma/test-driver +13 -6
- package/deps/jq/{modules → vendor}/oniguruma/windows/CMakeLists.txt +1 -1
- package/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/jq.js +2 -1
- package/package.json +4 -3
- package/test/santiy-async.test.js +4 -4
- package/test/santiy.test.js +4 -4
- package/test/template.test.js +6 -6
- package/deps/jq/modules/oniguruma/src/make_unicode_egcb.sh +0 -7
- package/deps/jq/modules/oniguruma/src/make_unicode_wb.sh +0 -7
- package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +0 -1592
- package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +0 -3394
- package/deps/jq/scripts/update-website +0 -30
- /package/deps/jq/{src → vendor}/decNumber/ICU-license.html +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decContext.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decContext.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decDPD.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decDouble.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decDouble.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decNumber.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decNumberLocal.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decPacked.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decPacked.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decQuad.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decQuad.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decSingle.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decSingle.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal128.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal128.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal32.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal32.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal64.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decimal64.h +0 -0
- /package/deps/jq/{src → vendor}/decNumber/decnumber.pdf +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example1.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example2.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example3.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example4.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example5.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example6.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example7.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/example8.c +0 -0
- /package/deps/jq/{src → vendor}/decNumber/readme.txt +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/.travis.yml +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/AUTHORS +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/COPYING +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/ChangeLog +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/NEWS +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/README +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/README_japanese +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/autogen.sh +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/cmake/Config.cmake.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.API +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.API.ja +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/doc/FAQ +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/doc/FAQ.ja +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/ascii_compatible.dict +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/deluxe.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/dict_conv.py +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/fuzzer.options +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/libfuzzer-onig.cpp +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/harnesses/regset.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/index.html +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/index_ja.html +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/m4/.whatever +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/make_win.bat +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/make_win32.bat +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/make_win64.bat +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/onig-config.cmake.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/onig-config.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/oniguruma.pc.cmake.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/oniguruma.pc.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/CMakeLists.txt +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/Makefile.am +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/bug_fix.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/callout.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/count.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/crnl.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/echo.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/encode.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/listcap.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/names.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/posix.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/regset.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/scan.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/simple.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/sql.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/syntax.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/sample/user_property.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/Makefile.am +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/Makefile.windows +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/big5.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.cmake.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.win32 +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.win64 +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.windows.in +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/cp1251.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp_prop.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp_prop.gperf +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/euc_kr.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/euc_tw.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/gb18030.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_1.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_10.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_11.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_13.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_14.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_15.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_16.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_2.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_3.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_4.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_5.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_6.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_7.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_8.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_9.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/koi8.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/koi8_r.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/make_property.sh +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/mktable.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/onig_init.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/oniggnu.h +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/onigposix.h +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regenc.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regenc.h +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regext.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/reggnu.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regparse.h +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regposerr.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regposix.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regtrav.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/regversion.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/sjis.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/sjis_prop.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/sjis_prop.gperf +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/unicode.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/utf32_be.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/utf32_le.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/src/utf8.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/test/CMakeLists.txt +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/test/Makefile.am +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/test/test.sh +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/test/test_regset.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/test/testu.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/stub.c +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_back.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_regset.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_syntax.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_utf8.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/testc.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/testu.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/tis.config +0 -0
- /package/deps/jq/{modules → vendor}/oniguruma/windows/testc.c +0 -0
package/deps/jq/src/main.c
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
extern void jv_tsd_dtoa_ctx_init();
|
|
22
22
|
#endif
|
|
23
23
|
|
|
24
|
+
#ifdef HAVE_LIBONIG
|
|
25
|
+
#include <oniguruma.h>
|
|
26
|
+
#endif
|
|
27
|
+
|
|
24
28
|
#if !defined(HAVE_ISATTY) && defined(HAVE__ISATTY)
|
|
25
29
|
#undef isatty
|
|
26
30
|
#define isatty _isatty
|
|
@@ -30,18 +34,14 @@ extern void jv_tsd_dtoa_ctx_init();
|
|
|
30
34
|
#define USE_ISATTY
|
|
31
35
|
#endif
|
|
32
36
|
|
|
33
|
-
#include "compile.h"
|
|
34
37
|
#include "jv.h"
|
|
35
38
|
#include "jq.h"
|
|
36
|
-
#include "jv_alloc.h"
|
|
37
39
|
#include "util.h"
|
|
38
40
|
#include "src/version.h"
|
|
39
41
|
#include "src/config_opts.inc"
|
|
40
42
|
|
|
41
43
|
int jq_testsuite(jv lib_dirs, int verbose, int argc, char* argv[]);
|
|
42
44
|
|
|
43
|
-
static const char* progname;
|
|
44
|
-
|
|
45
45
|
/*
|
|
46
46
|
* For a longer help message we could use a better option parsing
|
|
47
47
|
* strategy, one that lets stack options.
|
|
@@ -54,22 +54,19 @@ static void usage(int code, int keep_it_short) {
|
|
|
54
54
|
|
|
55
55
|
int ret = fprintf(f,
|
|
56
56
|
"jq - commandline JSON processor [version %s]\n"
|
|
57
|
-
"\nUsage:\
|
|
58
|
-
"\
|
|
59
|
-
"\
|
|
57
|
+
"\nUsage:\tjq [options] <jq filter> [file...]\n"
|
|
58
|
+
"\tjq [options] --args <jq filter> [strings...]\n"
|
|
59
|
+
"\tjq [options] --jsonargs <jq filter> [JSON_TEXTS...]\n\n"
|
|
60
60
|
"jq is a tool for processing JSON inputs, applying the given filter to\n"
|
|
61
61
|
"its JSON text inputs and producing the filter's results as JSON on\n"
|
|
62
62
|
"standard output.\n\n"
|
|
63
63
|
"The simplest filter is ., which copies jq's input to its output\n"
|
|
64
64
|
"unmodified except for formatting. For more advanced filters see\n"
|
|
65
|
-
"the jq(1) manpage (\"man jq\") and/or https://jqlang.
|
|
65
|
+
"the jq(1) manpage (\"man jq\") and/or https://jqlang.org/.\n\n"
|
|
66
66
|
"Example:\n\n\t$ echo '{\"foo\": 0}' | jq .\n"
|
|
67
|
-
"\t{\n\t \"foo\": 0\n\t}\n\n",
|
|
68
|
-
JQ_VERSION, progname, progname, progname);
|
|
67
|
+
"\t{\n\t \"foo\": 0\n\t}\n\n", JQ_VERSION);
|
|
69
68
|
if (keep_it_short) {
|
|
70
|
-
fprintf(f,
|
|
71
|
-
"For listing the command options, use %s --help.\n",
|
|
72
|
-
progname);
|
|
69
|
+
fprintf(f, "For listing the command options, use jq --help.\n");
|
|
73
70
|
} else {
|
|
74
71
|
(void) fprintf(f,
|
|
75
72
|
"Command options:\n"
|
|
@@ -94,8 +91,8 @@ static void usage(int code, int keep_it_short) {
|
|
|
94
91
|
" --stream-errors implies --stream and report parse error as\n"
|
|
95
92
|
" an array;\n"
|
|
96
93
|
" --seq parse input/output as application/json-seq;\n"
|
|
97
|
-
" -f, --from-file
|
|
98
|
-
" -L
|
|
94
|
+
" -f, --from-file load the filter from a file;\n"
|
|
95
|
+
" -L, --library-path dir search modules from the directory;\n"
|
|
99
96
|
" --arg name value set $name to the string value;\n"
|
|
100
97
|
" --argjson name value set $name to the JSON value;\n"
|
|
101
98
|
" --slurpfile name file set $name to an array of JSON values read\n"
|
|
@@ -119,30 +116,28 @@ static void usage(int code, int keep_it_short) {
|
|
|
119
116
|
exit((ret < 0 && code == 0) ? 2 : code);
|
|
120
117
|
}
|
|
121
118
|
|
|
122
|
-
static void die() {
|
|
123
|
-
fprintf(stderr, "Use
|
|
124
|
-
fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.
|
|
119
|
+
static void die(void) {
|
|
120
|
+
fprintf(stderr, "Use jq --help for help with command-line options,\n");
|
|
121
|
+
fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.org\n");
|
|
125
122
|
exit(2);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
125
|
static int isoptish(const char* text) {
|
|
129
|
-
return text[0] == '-' && (text[1] == '-' || isalpha(text[1]));
|
|
126
|
+
return text[0] == '-' && (text[1] == '-' || isalpha((unsigned char)text[1]));
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
static int isoption(const char
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
else
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
(*short_opts)++; // ...count it (for option stacking)
|
|
145
|
-
return 1;
|
|
129
|
+
static int isoption(const char** text, char shortopt, const char* longopt, int is_short) {
|
|
130
|
+
if (is_short) {
|
|
131
|
+
if (shortopt && **text == shortopt) {
|
|
132
|
+
(*text)++;
|
|
133
|
+
if (!**text) *text = NULL;
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
if (!strcmp(*text, longopt)) {
|
|
138
|
+
*text = NULL;
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
146
141
|
}
|
|
147
142
|
return 0;
|
|
148
143
|
}
|
|
@@ -162,9 +157,8 @@ enum {
|
|
|
162
157
|
UNBUFFERED_OUTPUT = 2048,
|
|
163
158
|
EXIT_STATUS = 4096,
|
|
164
159
|
SEQ = 16384,
|
|
165
|
-
RUN_TESTS = 32768,
|
|
166
160
|
/* debugging only */
|
|
167
|
-
DUMP_DISASM =
|
|
161
|
+
DUMP_DISASM = 32768,
|
|
168
162
|
};
|
|
169
163
|
|
|
170
164
|
enum {
|
|
@@ -180,21 +174,6 @@ enum {
|
|
|
180
174
|
|
|
181
175
|
#define TIMEOUT_SEC 5
|
|
182
176
|
|
|
183
|
-
static const char *skip_shebang(const char *p) {
|
|
184
|
-
if (strncmp(p, "#!", sizeof("#!") - 1) != 0)
|
|
185
|
-
return p;
|
|
186
|
-
const char *n = strchr(p, '\n');
|
|
187
|
-
if (n == NULL || n[1] != '#')
|
|
188
|
-
return p;
|
|
189
|
-
n = strchr(n + 1, '\n');
|
|
190
|
-
if (n == NULL || n[1] == '#' || n[1] == '\0' || n[-1] != '\\' || n[-2] == '\\')
|
|
191
|
-
return p;
|
|
192
|
-
n = strchr(n + 1, '\n');
|
|
193
|
-
if (n == NULL)
|
|
194
|
-
return p;
|
|
195
|
-
return n+1;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
177
|
static int process(jq_state *jq, jv value, int flags, int dumpopts, int options) {
|
|
199
178
|
int ret = JQ_OK_NO_OUTPUT; // No valid results && -e -> exit(4)
|
|
200
179
|
jq_start(jq, value, flags);
|
|
@@ -325,6 +304,13 @@ int main(int argc, char* argv[]) {
|
|
|
325
304
|
(void) setlocale(LC_ALL, "");
|
|
326
305
|
#endif
|
|
327
306
|
|
|
307
|
+
#ifdef HAVE_LIBONIG
|
|
308
|
+
// use a lower regex parse depth limit than the default (4096) to protect
|
|
309
|
+
// from stack-overflows
|
|
310
|
+
// https://github.com/jqlang/jq/security/advisories/GHSA-f946-j5j2-4w5m
|
|
311
|
+
onig_set_parse_depth_limit(1024);
|
|
312
|
+
#endif
|
|
313
|
+
|
|
328
314
|
#ifdef __OpenBSD__
|
|
329
315
|
if (pledge("stdio rpath", NULL) == -1) {
|
|
330
316
|
perror("pledge");
|
|
@@ -343,8 +329,6 @@ int main(int argc, char* argv[]) {
|
|
|
343
329
|
jv ARGS = jv_array(); /* positional arguments */
|
|
344
330
|
jv program_arguments = jv_object(); /* named arguments */
|
|
345
331
|
|
|
346
|
-
if (argc) progname = argv[0];
|
|
347
|
-
|
|
348
332
|
jq = jq_init();
|
|
349
333
|
if (jq == NULL) {
|
|
350
334
|
perror("jq_init");
|
|
@@ -361,9 +345,8 @@ int main(int argc, char* argv[]) {
|
|
|
361
345
|
int further_args_are_json = 0;
|
|
362
346
|
int args_done = 0;
|
|
363
347
|
int jq_flags = 0;
|
|
364
|
-
size_t short_opts = 0;
|
|
365
348
|
jv lib_search_paths = jv_null();
|
|
366
|
-
for (int i=1; i<argc; i
|
|
349
|
+
for (int i=1; i<argc; i++) {
|
|
367
350
|
if (args_done || !isoptish(argv[i])) {
|
|
368
351
|
if (!program) {
|
|
369
352
|
program = argv[i];
|
|
@@ -372,7 +355,7 @@ int main(int argc, char* argv[]) {
|
|
|
372
355
|
} else if (further_args_are_json) {
|
|
373
356
|
jv v = jv_parse(argv[i]);
|
|
374
357
|
if (!jv_is_valid(v)) {
|
|
375
|
-
fprintf(stderr, "
|
|
358
|
+
fprintf(stderr, "jq: invalid JSON text passed to --jsonargs\n");
|
|
376
359
|
die();
|
|
377
360
|
}
|
|
378
361
|
ARGS = jv_array_append(ARGS, v);
|
|
@@ -383,223 +366,174 @@ int main(int argc, char* argv[]) {
|
|
|
383
366
|
} else if (!strcmp(argv[i], "--")) {
|
|
384
367
|
args_done = 1;
|
|
385
368
|
} else {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (
|
|
440
|
-
}
|
|
441
|
-
if (isoption(argv[i], 'R', "raw-input", &short_opts)) {
|
|
442
|
-
options |= RAW_INPUT;
|
|
443
|
-
if (!short_opts) continue;
|
|
444
|
-
}
|
|
445
|
-
if (isoption(argv[i], 'n', "null-input", &short_opts)) {
|
|
446
|
-
options |= PROVIDE_NULL;
|
|
447
|
-
if (!short_opts) continue;
|
|
448
|
-
}
|
|
449
|
-
if (isoption(argv[i], 'f', "from-file", &short_opts)) {
|
|
450
|
-
options |= FROM_FILE;
|
|
451
|
-
if (!short_opts) continue;
|
|
452
|
-
}
|
|
453
|
-
if (isoption(argv[i], 'b', "binary", &short_opts)) {
|
|
369
|
+
const char* text = argv[i];
|
|
370
|
+
int is_short;
|
|
371
|
+
// First '-' already checked by isoptish
|
|
372
|
+
if (text[1] == '-') {
|
|
373
|
+
text += 2;
|
|
374
|
+
is_short = 0;
|
|
375
|
+
} else {
|
|
376
|
+
text++;
|
|
377
|
+
is_short = 1;
|
|
378
|
+
}
|
|
379
|
+
int raw; // Temporary for --rawfile
|
|
380
|
+
|
|
381
|
+
// Parse a long option in one iteration or iterate over short options
|
|
382
|
+
while (text != NULL) {
|
|
383
|
+
if (isoption(&text, 's', "slurp", is_short)) {
|
|
384
|
+
options |= SLURP;
|
|
385
|
+
} else if (isoption(&text, 'r', "raw-output", is_short)) {
|
|
386
|
+
options |= RAW_OUTPUT;
|
|
387
|
+
} else if (isoption(&text, 0, "raw-output0", is_short)) {
|
|
388
|
+
options |= RAW_OUTPUT | RAW_NO_LF | RAW_OUTPUT0;
|
|
389
|
+
} else if (isoption(&text, 'j', "join-output", is_short)) {
|
|
390
|
+
options |= RAW_OUTPUT | RAW_NO_LF;
|
|
391
|
+
} else if (isoption(&text, 'c', "compact-output", is_short)) {
|
|
392
|
+
dumpopts &= ~(JV_PRINT_TAB | JV_PRINT_INDENT_FLAGS(7));
|
|
393
|
+
} else if (isoption(&text, 'C', "color-output", is_short)) {
|
|
394
|
+
options |= COLOR_OUTPUT;
|
|
395
|
+
} else if (isoption(&text, 'M', "monochrome-output", is_short)) {
|
|
396
|
+
options |= NO_COLOR_OUTPUT;
|
|
397
|
+
} else if (isoption(&text, 'a', "ascii-output", is_short)) {
|
|
398
|
+
options |= ASCII_OUTPUT;
|
|
399
|
+
} else if (isoption(&text, 0, "unbuffered", is_short)) {
|
|
400
|
+
options |= UNBUFFERED_OUTPUT;
|
|
401
|
+
} else if (isoption(&text, 'S', "sort-keys", is_short)) {
|
|
402
|
+
options |= SORTED_OUTPUT;
|
|
403
|
+
} else if (isoption(&text, 'R', "raw-input", is_short)) {
|
|
404
|
+
options |= RAW_INPUT;
|
|
405
|
+
} else if (isoption(&text, 'n', "null-input", is_short)) {
|
|
406
|
+
options |= PROVIDE_NULL;
|
|
407
|
+
} else if (isoption(&text, 'f', "from-file", is_short)) {
|
|
408
|
+
options |= FROM_FILE;
|
|
409
|
+
} else if (isoption(&text, 'L', "library-path", is_short)) {
|
|
410
|
+
if (jv_get_kind(lib_search_paths) == JV_KIND_NULL)
|
|
411
|
+
lib_search_paths = jv_array();
|
|
412
|
+
if (text != NULL) { // -Lname
|
|
413
|
+
lib_search_paths = jv_array_append(lib_search_paths, jq_realpath(jv_string(text)));
|
|
414
|
+
text = NULL;
|
|
415
|
+
} else if (i >= argc - 1) {
|
|
416
|
+
fprintf(stderr, "-L takes a parameter: (e.g. -L /search/path or -L/search/path)\n");
|
|
417
|
+
die();
|
|
418
|
+
} else {
|
|
419
|
+
lib_search_paths = jv_array_append(lib_search_paths, jq_realpath(jv_string(argv[i+1])));
|
|
420
|
+
i++;
|
|
421
|
+
}
|
|
422
|
+
} else if (isoption(&text, 'b', "binary", is_short)) {
|
|
454
423
|
#ifdef WIN32
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
if (!short_opts) continue;
|
|
424
|
+
fflush(stdout);
|
|
425
|
+
fflush(stderr);
|
|
426
|
+
_setmode(fileno(stdin), _O_BINARY);
|
|
427
|
+
_setmode(fileno(stdout), _O_BINARY);
|
|
428
|
+
_setmode(fileno(stderr), _O_BINARY);
|
|
461
429
|
#endif
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
if (isoption(argv[i], 0, "indent", &short_opts)) {
|
|
469
|
-
if (i >= argc - 1) {
|
|
470
|
-
fprintf(stderr, "%s: --indent takes one parameter\n", progname);
|
|
471
|
-
die();
|
|
472
|
-
}
|
|
473
|
-
dumpopts &= ~(JV_PRINT_TAB | JV_PRINT_INDENT_FLAGS(7));
|
|
474
|
-
int indent = atoi(argv[i+1]);
|
|
475
|
-
if (indent < -1 || indent > 7) {
|
|
476
|
-
fprintf(stderr, "%s: --indent takes a number between -1 and 7\n", progname);
|
|
477
|
-
die();
|
|
478
|
-
}
|
|
479
|
-
dumpopts |= JV_PRINT_INDENT_FLAGS(indent);
|
|
480
|
-
i++;
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
if (isoption(argv[i], 0, "seq", &short_opts)) {
|
|
484
|
-
options |= SEQ;
|
|
485
|
-
continue;
|
|
486
|
-
}
|
|
487
|
-
if (isoption(argv[i], 0, "stream", &short_opts)) {
|
|
488
|
-
parser_flags |= JV_PARSE_STREAMING;
|
|
489
|
-
continue;
|
|
490
|
-
}
|
|
491
|
-
if (isoption(argv[i], 0, "stream-errors", &short_opts)) {
|
|
492
|
-
parser_flags |= JV_PARSE_STREAMING | JV_PARSE_STREAM_ERRORS;
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
if (isoption(argv[i], 'e', "exit-status", &short_opts)) {
|
|
496
|
-
options |= EXIT_STATUS;
|
|
497
|
-
if (!short_opts) continue;
|
|
498
|
-
}
|
|
499
|
-
// FIXME: For --arg* we should check that the varname is acceptable
|
|
500
|
-
if (isoption(argv[i], 0, "args", &short_opts)) {
|
|
501
|
-
further_args_are_strings = 1;
|
|
502
|
-
further_args_are_json = 0;
|
|
503
|
-
continue;
|
|
504
|
-
}
|
|
505
|
-
if (isoption(argv[i], 0, "jsonargs", &short_opts)) {
|
|
506
|
-
further_args_are_strings = 0;
|
|
507
|
-
further_args_are_json = 1;
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
510
|
-
if (isoption(argv[i], 0, "arg", &short_opts)) {
|
|
511
|
-
if (i >= argc - 2) {
|
|
512
|
-
fprintf(stderr, "%s: --arg takes two parameters (e.g. --arg varname value)\n", progname);
|
|
513
|
-
die();
|
|
514
|
-
}
|
|
515
|
-
if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1])))
|
|
516
|
-
program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), jv_string(argv[i+2]));
|
|
517
|
-
i += 2; // skip the next two arguments
|
|
518
|
-
continue;
|
|
519
|
-
}
|
|
520
|
-
if (isoption(argv[i], 0, "argjson", &short_opts)) {
|
|
521
|
-
if (i >= argc - 2) {
|
|
522
|
-
fprintf(stderr, "%s: --argjson takes two parameters (e.g. --argjson varname text)\n", progname);
|
|
523
|
-
die();
|
|
524
|
-
}
|
|
525
|
-
if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) {
|
|
526
|
-
jv v = jv_parse(argv[i+2]);
|
|
527
|
-
if (!jv_is_valid(v)) {
|
|
528
|
-
fprintf(stderr, "%s: invalid JSON text passed to --argjson\n", progname);
|
|
430
|
+
} else if (isoption(&text, 0, "tab", is_short)) {
|
|
431
|
+
dumpopts &= ~JV_PRINT_INDENT_FLAGS(7);
|
|
432
|
+
dumpopts |= JV_PRINT_TAB | JV_PRINT_PRETTY;
|
|
433
|
+
} else if (isoption(&text, 0, "indent", is_short)) {
|
|
434
|
+
if (i >= argc - 1) {
|
|
435
|
+
fprintf(stderr, "jq: --indent takes one parameter\n");
|
|
529
436
|
die();
|
|
530
437
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
else
|
|
543
|
-
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
438
|
+
char* end = NULL;
|
|
439
|
+
errno = 0;
|
|
440
|
+
long indent = strtol(argv[i+1], &end, 10);
|
|
441
|
+
if (errno || indent < -1 || indent > 7 ||
|
|
442
|
+
isspace(*argv[i+1]) || end == argv[i+1] || *end) {
|
|
443
|
+
fprintf(stderr, "jq: --indent takes a number between -1 and 7\n");
|
|
444
|
+
die();
|
|
445
|
+
}
|
|
446
|
+
dumpopts &= ~(JV_PRINT_TAB | JV_PRINT_INDENT_FLAGS(7));
|
|
447
|
+
dumpopts |= JV_PRINT_INDENT_FLAGS(indent);
|
|
448
|
+
i++;
|
|
449
|
+
} else if (isoption(&text, 0, "seq", is_short)) {
|
|
450
|
+
options |= SEQ;
|
|
451
|
+
} else if (isoption(&text, 0, "stream", is_short)) {
|
|
452
|
+
parser_flags |= JV_PARSE_STREAMING;
|
|
453
|
+
} else if (isoption(&text, 0, "stream-errors", is_short)) {
|
|
454
|
+
parser_flags |= JV_PARSE_STREAMING | JV_PARSE_STREAM_ERRORS;
|
|
455
|
+
} else if (isoption(&text, 'e', "exit-status", is_short)) {
|
|
456
|
+
options |= EXIT_STATUS;
|
|
457
|
+
} else if (isoption(&text, 0, "args", is_short)) {
|
|
458
|
+
further_args_are_strings = 1;
|
|
459
|
+
further_args_are_json = 0;
|
|
460
|
+
} else if (isoption(&text, 0, "jsonargs", is_short)) {
|
|
461
|
+
further_args_are_strings = 0;
|
|
462
|
+
further_args_are_json = 1;
|
|
463
|
+
} else if (isoption(&text, 0, "arg", is_short)) {
|
|
464
|
+
if (i >= argc - 2) {
|
|
465
|
+
fprintf(stderr, "jq: --arg takes two parameters (e.g. --arg varname value)\n");
|
|
466
|
+
die();
|
|
557
467
|
}
|
|
558
|
-
|
|
468
|
+
if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1])))
|
|
469
|
+
program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), jv_string(argv[i+2]));
|
|
470
|
+
i += 2; // skip the next two arguments
|
|
471
|
+
} else if (isoption(&text, 0, "argjson", is_short)) {
|
|
472
|
+
if (i >= argc - 2) {
|
|
473
|
+
fprintf(stderr, "jq: --argjson takes two parameters (e.g. --argjson varname text)\n");
|
|
474
|
+
die();
|
|
475
|
+
}
|
|
476
|
+
if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) {
|
|
477
|
+
jv v = jv_parse(argv[i+2]);
|
|
478
|
+
if (!jv_is_valid(v)) {
|
|
479
|
+
fprintf(stderr, "jq: invalid JSON text passed to --argjson\n");
|
|
480
|
+
die();
|
|
481
|
+
}
|
|
482
|
+
program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), v);
|
|
483
|
+
}
|
|
484
|
+
i += 2; // skip the next two arguments
|
|
485
|
+
} else if ((raw = isoption(&text, 0, "rawfile", is_short)) ||
|
|
486
|
+
isoption(&text, 0, "slurpfile", is_short)) {
|
|
487
|
+
const char *which = raw ? "rawfile" : "slurpfile";
|
|
488
|
+
if (i >= argc - 2) {
|
|
489
|
+
fprintf(stderr, "jq: --%s takes two parameters (e.g. --%s varname filename)\n", which, which);
|
|
490
|
+
die();
|
|
491
|
+
}
|
|
492
|
+
if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) {
|
|
493
|
+
jv data = jv_load_file(argv[i+2], raw);
|
|
494
|
+
if (!jv_is_valid(data)) {
|
|
495
|
+
data = jv_invalid_get_msg(data);
|
|
496
|
+
fprintf(stderr, "jq: Bad JSON in --%s %s %s: %s\n", which,
|
|
497
|
+
argv[i+1], argv[i+2], jv_string_value(data));
|
|
498
|
+
jv_free(data);
|
|
499
|
+
ret = JQ_ERROR_SYSTEM;
|
|
500
|
+
goto out;
|
|
501
|
+
}
|
|
502
|
+
program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), data);
|
|
503
|
+
}
|
|
504
|
+
i += 2; // skip the next two arguments
|
|
505
|
+
} else if (isoption(&text, 0, "debug-dump-disasm", is_short)) {
|
|
506
|
+
options |= DUMP_DISASM;
|
|
507
|
+
} else if (isoption(&text, 0, "debug-trace=all", is_short)) {
|
|
508
|
+
jq_flags |= JQ_DEBUG_TRACE_ALL;
|
|
509
|
+
} else if (isoption(&text, 0, "debug-trace", is_short)) {
|
|
510
|
+
jq_flags |= JQ_DEBUG_TRACE;
|
|
511
|
+
} else if (isoption(&text, 'h', "help", is_short)) {
|
|
512
|
+
usage(0, 0);
|
|
513
|
+
} else if (isoption(&text, 'V', "version", is_short)) {
|
|
514
|
+
printf("jq-%s\n", JQ_VERSION);
|
|
515
|
+
ret = JQ_OK;
|
|
516
|
+
goto out;
|
|
517
|
+
} else if (isoption(&text, 0, "build-configuration", is_short)) {
|
|
518
|
+
printf("%s\n", JQ_CONFIG);
|
|
519
|
+
ret = JQ_OK;
|
|
520
|
+
goto out;
|
|
521
|
+
} else if (isoption(&text, 0, "run-tests", is_short)) {
|
|
522
|
+
i++;
|
|
523
|
+
// XXX Pass program_arguments, even a whole jq_state *, through;
|
|
524
|
+
// could be useful for testing
|
|
525
|
+
ret = jq_testsuite(lib_search_paths,
|
|
526
|
+
(options & DUMP_DISASM) || (jq_flags & JQ_DEBUG_TRACE),
|
|
527
|
+
argc - i, argv + i);
|
|
528
|
+
goto out;
|
|
529
|
+
} else {
|
|
530
|
+
if (is_short) {
|
|
531
|
+
fprintf(stderr, "jq: Unknown option -%c\n", text[0]);
|
|
532
|
+
} else {
|
|
533
|
+
fprintf(stderr, "jq: Unknown option --%s\n", text);
|
|
534
|
+
}
|
|
535
|
+
die();
|
|
559
536
|
}
|
|
560
|
-
i += 2; // skip the next two arguments
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
if (isoption(argv[i], 0, "debug-dump-disasm", &short_opts)) {
|
|
564
|
-
options |= DUMP_DISASM;
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (isoption(argv[i], 0, "debug-trace=all", &short_opts)) {
|
|
568
|
-
jq_flags |= JQ_DEBUG_TRACE_ALL;
|
|
569
|
-
if (!short_opts) continue;
|
|
570
|
-
}
|
|
571
|
-
if (isoption(argv[i], 0, "debug-trace", &short_opts)) {
|
|
572
|
-
jq_flags |= JQ_DEBUG_TRACE;
|
|
573
|
-
continue;
|
|
574
|
-
}
|
|
575
|
-
if (isoption(argv[i], 'h', "help", &short_opts)) {
|
|
576
|
-
usage(0, 0);
|
|
577
|
-
if (!short_opts) continue;
|
|
578
|
-
}
|
|
579
|
-
if (isoption(argv[i], 'V', "version", &short_opts)) {
|
|
580
|
-
printf("jq-%s\n", JQ_VERSION);
|
|
581
|
-
ret = JQ_OK;
|
|
582
|
-
goto out;
|
|
583
|
-
}
|
|
584
|
-
if (isoption(argv[i], 0, "build-configuration", &short_opts)) {
|
|
585
|
-
printf("%s\n", JQ_CONFIG);
|
|
586
|
-
ret = JQ_OK;
|
|
587
|
-
goto out;
|
|
588
|
-
}
|
|
589
|
-
if (isoption(argv[i], 0, "run-tests", &short_opts)) {
|
|
590
|
-
i++;
|
|
591
|
-
// XXX Pass program_arguments, even a whole jq_state *, through;
|
|
592
|
-
// could be useful for testing
|
|
593
|
-
ret = jq_testsuite(lib_search_paths,
|
|
594
|
-
(options & DUMP_DISASM) || (jq_flags & JQ_DEBUG_TRACE),
|
|
595
|
-
argc - i, argv + i);
|
|
596
|
-
goto out;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// check for unknown options... if this argument was a short option
|
|
600
|
-
if (strlen(argv[i]) != short_opts + 1) {
|
|
601
|
-
fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);
|
|
602
|
-
die();
|
|
603
537
|
}
|
|
604
538
|
}
|
|
605
539
|
}
|
|
@@ -633,7 +567,7 @@ int main(int argc, char* argv[]) {
|
|
|
633
567
|
if (options & COLOR_OUTPUT) dumpopts |= JV_PRINT_COLOR;
|
|
634
568
|
if (options & NO_COLOR_OUTPUT) dumpopts &= ~JV_PRINT_COLOR;
|
|
635
569
|
|
|
636
|
-
if (
|
|
570
|
+
if (!jq_set_colors(getenv("JQ_COLORS")))
|
|
637
571
|
fprintf(stderr, "Failed to set $JQ_COLORS\n");
|
|
638
572
|
|
|
639
573
|
if (jv_get_kind(lib_search_paths) == JV_KIND_NULL) {
|
|
@@ -658,7 +592,7 @@ int main(int argc, char* argv[]) {
|
|
|
658
592
|
jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string_fmt("%.*s-master", (int)(strchr(JQ_VERSION, '-') - JQ_VERSION), JQ_VERSION));
|
|
659
593
|
|
|
660
594
|
#ifdef USE_ISATTY
|
|
661
|
-
if (!program && (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)))
|
|
595
|
+
if (!program && !(options & FROM_FILE) && (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)))
|
|
662
596
|
program = ".";
|
|
663
597
|
#endif
|
|
664
598
|
|
|
@@ -674,7 +608,7 @@ int main(int argc, char* argv[]) {
|
|
|
674
608
|
jv data = jv_load_file(program, 1);
|
|
675
609
|
if (!jv_is_valid(data)) {
|
|
676
610
|
data = jv_invalid_get_msg(data);
|
|
677
|
-
fprintf(stderr, "
|
|
611
|
+
fprintf(stderr, "jq: %s\n", jv_string_value(data));
|
|
678
612
|
jv_free(data);
|
|
679
613
|
ret = JQ_ERROR_SYSTEM;
|
|
680
614
|
goto out;
|
|
@@ -687,7 +621,7 @@ int main(int argc, char* argv[]) {
|
|
|
687
621
|
program_arguments = jv_object_set(program_arguments,
|
|
688
622
|
jv_string("JQ_BUILD_CONFIGURATION"),
|
|
689
623
|
jv_string(JQ_CONFIG)); /* named arguments */
|
|
690
|
-
compiled = jq_compile_args(jq,
|
|
624
|
+
compiled = jq_compile_args(jq, jv_string_value(data), jv_copy(program_arguments));
|
|
691
625
|
free(program_origin);
|
|
692
626
|
jv_free(data);
|
|
693
627
|
} else {
|