Compare commits

...
353 Commits
Author SHA1 Message Date
Nicolas Williams 11c528d04d Add setlocale() call (fix #1740) 2023-09-06 14:05:10 -05:00
Nicolas Williams ac3b70d3a1 Add a thank you note to the new owners, admins, and maintainers, and to @stedolan 2023-09-06 13:01:44 -05:00
Nico Williams df95871dd7 Fix leak on too-large programs, OSS Fuzz issue 61349
A very large program can cause these leaks:

  ==758838== 7,820 (16 direct, 7,804 indirect) bytes in 2 blocks are definitely lost in loss record 17 of 28
  ==758838==    at 0x4848A23: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==758838==    by 0x125D30: jv_mem_calloc (jv_alloc.c:153)
  ==758838==    by 0x162ADE: compile (compile.c:1286)
  ==758838==    by 0x162D4B: compile (compile.c:1304)
  ==758838==    by 0x163697: block_compile (compile.c:1381)
  ==758838==    by 0x11B5CA: jq_compile_args (execute.c:1245)
  ==758838==    by 0x115E20: main (main.c:691)
  ==758838==
  ==758838== 1,674,694 (103,576 direct, 1,571,118 indirect) bytes in 1,177 blocks are definitely lost in loss record 28 of 28
  ==758838==    at 0x4843839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==758838==    by 0x125CD0: jv_mem_alloc (jv_alloc.c:141)
  ==758838==    by 0x162B19: compile (compile.c:1289)
  ==758838==    by 0x163697: block_compile (compile.c:1381)
  ==758838==    by 0x11B5CA: jq_compile_args (execute.c:1245)
  ==758838==    by 0x115E20: main (main.c:691)

This commit fixes that.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61349
2023-08-29 10:27:41 +02:00
github-actions[bot] 91d72575e4 Update signatures of 1.7rc2 2023-08-27 12:53:29 -05:00
Nicolas Williams 0e067ef936 Improve handling of non-integer numeric indices (fix #2815) 2023-08-27 12:32:12 +02:00
Emanuele Torre ab47880b4c Make jq_get_lib_dirs return an empty array if JQ_LIBRARY_PATH is not set
For the jq_state used by the jq utility, the JQ_LIBRARY_PATH attribute
will always be set, but, in general, it is possible that it might not
be.

If it is not set, jq_get_lib_dirs() will return jv_invalid().

That is not good, because some code in linker.c expects it to always
returns an array.

This patch makes jq_get_lib_dirs() return an empty array if
JQ_LIBRARY_PATH is not set to prevent problems.

This issue made OSS fuzz trigger failed assertions every time it tried
to compile a script that uses "include".

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61796
2023-08-27 00:37:54 -05:00
Emanuele Torre 6436f1e0f8 Fix memory leak in find_lib for some invalid inputs 2023-08-26 17:17:29 -05:00
Nicolas Williams 2c3561810d Check nomem_handler->handler before calling it 2023-08-25 10:13:46 -05:00
itchyny 70807e2b1b Include more updates to NEWS.md and AUTHORS for 1.7 2023-08-23 15:59:19 -05:00
itchyny 080471b2a0 Add src/config_opts.inc to .gitignore 2023-08-21 16:06:58 +02:00
Nicolas Williams 583e4a2718 Add --config option printing ./configure options used 2023-08-19 17:40:08 -05:00
itchyny 7d64381016 Fix overflow on numeric comparison (#2849)
Although #2839 fixed the overflow of exponent subtraction,
there still is possibility of overflow in the `D2U` macro.
This patch fixes the overflow in the `D2U` macro, and also
truncates the maximum digits to `DEC_MAX_DIGITS`.
2023-08-17 15:56:57 +09:00
itchyny 0733fd3d58 Add a regression test for negative indices and fix a pick/1 test 2023-08-16 17:49:44 -05:00
itchyny f85c9fcb78 Revert "Allow .[-1] in path expressions"
This reverts commit 086a156ec3.

This commit leads to negative indexing wraps twice.
2023-08-16 17:49:44 -05:00
Emanuele Torre 4cf1408e0b Cast function pointers without prototype before calling them (#2842)
clang complained that this is deprecated in all versions of standard C,
and unsupported in C2x.
2023-08-13 22:39:54 +09:00
itchyny 3fa10e8cc1 Fix crash on numeric comparison again (ref #2825)
The decNumber library subtracts the exponents of two numbers,
we make sure to limit the number of digits not to make it overflows.
Since the maximum adjusted exponent is `emax` and the minimum is
`emin - digits + 1`, we follow `emax - (emin - digits + 1) <= INT32_MAX`.
2023-08-13 14:17:25 +02:00
itchyny f86566b263 Rename jv_type_private.h to jv_private.h, move jvp_number_is_nan there 2023-08-13 14:16:02 +02:00
Alex Wilson f31c180e8f Update documentation to reflect new defs field on modulemeta 2023-08-12 20:46:36 -05:00
Alex Wilson 65ed95c93a Expose the names of a module's defined function via modulemeta
This reuses the existing `block_list_funcs` capability and adds an extra field on the `modulemeta` output, called `defs`, containing that list of functions.
2023-08-12 20:46:36 -05:00
Mattias WadmanandNicolas Williams fdab39bc7b Build windows 64bit binary using UCRT64 (#2832)
* Build windows 64bit binary using UCRT64

Is the default and recommended msystem setting. Will produce
binaries that are compatible with windows 10 and later.

Also run tests for 32bit build.

Related to #2831

* Use jq -b in tests/shtest

* Add Windows strptime

* Make Windows-optional tests not run on Windows again

---------

Co-authored-by: Nicolas Williams <nico@cryptonector.com>
2023-08-12 20:18:45 +02:00
Mattias Wadman 5a52553a3b Make sure to init key and dbl_key also on win32
Hopefully fixes page fault for mingw build

Related to #2831
2023-08-10 13:06:03 -05:00
Mattias Wadman 765a5c77eb Make sure to init dtoa_ctx_key also on win32 (#2834)
Fixes page fault for mingw build

Related to #2831
2023-08-10 18:53:50 +02:00
Naïm Favier d1a6da2205 docs: fix delpaths description 2023-08-09 18:20:04 +02:00
itchyny a692060129 Change the default color of null to Bright Black 2023-08-05 23:21:12 -05:00
Emanuele Torre f94a9d463f Let error(null) throw null
This patch removes the weird behaviour of jv_invalid_with_msg(jv_null())
that returns jv_invalid() (i.e. empty), instead of a boxed jv_null().

The previous behaviour of  null|error  was obviously unintentional, and
allowing is jv_invalid_with_msg() to return values on which you can't
call jv_invalid_get_msg() is only error prone.
2023-08-04 17:38:52 -05:00
Emanuele Torre 3b6e7ddd72 Constant fold all kinds of constants
This patch exports all the binary operator builtins functions from
builtin.c and uses them for constant folding in the parser, allowing
constant folding to work will all kinds and combinations of constants.

Now string*number,  $ARGS+$ARGS,  string/string,  etc will also be
constant folded and the implementation of constant folded operators and
runtime operators will be the same.

And thanks to the new ERRORK bytecode operation, errors are constant
folded too! (e.g. 1 / 0   [] * {}   etc)
2023-08-04 11:47:34 -05:00
Emanuele Torre 5fc5453409 Add ERRORK opcode to trigger constant errors 2023-08-04 11:47:34 -05:00
Nicolas Williams 71941a0d47 Clarify the // operator (fix typo) 2023-08-03 23:24:12 -05:00
Emanuele Torre dcaf701ef6 Simplify String rule in parser (#2805)
Use a StringStart component that is either FORMAT QQSTRING_START or
QQSTRING_START instead of having two similar rules for String.

This is simpler and avoids having to use an untyped mid-rule action
component to copy FORMAT at the top of the stack before QQString, and
having to use jv_free($<literal>3) instead of jv_free($1) just to make
bison not complain about the "unused" mid-rule component.
2023-08-04 08:21:25 +09:00
Nicolas Williams d8327a90b8 Add a bit more text about generators 2023-08-03 14:41:53 -05:00
Nicolas Williams ddef804945 Clarify the // operator (close #2189) 2023-08-03 14:41:53 -05:00
itchyny 949d38e6dc Fix crash on numeric comparison (ref #2804) (#2818) 2023-08-03 23:19:52 +09:00
Owen Ou 53a62cf2b0 Improve README to be more structural and more readable (#2814) 2023-08-03 22:27:09 +09:00
Nicolas Williams ff4bf68b29 Enable stack protection (CI release executables) 2023-08-02 12:19:19 -05:00
itchyny fd0d475694 Fix a test case added in #2790 2023-08-02 22:33:09 +09:00
itchynyandLeonid S. Usov 680baeffeb Fix rounding small (but not too small) numbers to zero on calculation
Co-authored-by: Leonid S. Usov <leonid.s.usov@gmail.com>
2023-08-02 00:32:32 -05:00
Nicolas Williams 27a4d5757e Require a main program (fix #2785) 2023-08-01 23:06:01 -05:00
pkoppstein 044b38595c NEWS.md - sub and gsub (#2809) 2023-08-02 08:38:27 +09:00
Owen Ou 161ab0402b Fix typo in CI env vars for Linux build (#2810)
For some reason, the env vars are set correctly without refering the variable in `matrix` case-sensitvely:

```
2023-08-01T05:05:58.4626090Z env:
2023-08-01T05:05:58.4626367Z   AR: arm-linux-gnueabihf-ar
2023-08-01T05:05:58.4626690Z   CHOST: arm-linux-gnueabihf
2023-08-01T05:05:58.4626961Z   CC: arm-linux-gnueabihf-gcc
2023-08-01T05:05:58.4627332Z   CPP: arm-linux-gnueabihf-cpp
2023-08-01T05:05:58.4627662Z   CXX: arm-linux-gnueabihf-g++
```

For clarify, we update them to match the definitions. Besides, `CXX` is
not needed and removed.
2023-08-01 07:32:52 -07:00
Nicolas Williams 29698118c5 Update download page with new release key 2023-07-31 23:59:09 -05:00
Emanuele Torre 96263f2e4b Don't unnecessarily ignore missing-field-initializers warnings 2023-07-31 23:16:02 -05:00
Nicolas Williams 90a6b2d9e6 Re-generate src/parser.[ch] 2023-07-31 20:04:41 -05:00
pkoppstein 4d4c17ca6a Simple and efficient implementation of walk/1 (#2795) 2023-08-01 07:54:21 +09:00
itchyny 0f80921268 Fix constant folding of division and reminder with zero divisor
Previously constant folding of zero division (e.x. 1/0) produces a
compile error. This was incorrectly implemented by checking if the
division result is infinite, so produces wrong results compared to the
query where no constant folding is processed (e.x. 1e308/0.1). This
patch delays the operation when the divisor is zero. This makes the
results more consistent, but changes the exit code on zero division from
3 to 5. Also 0/0 now produces the zero division error, not NaN.

This patch also fixes the modulo operation. Previously constant folding
logic does not take care of the % operator, but now it folds if the both
dividend and divisor are safe numbers to cast to the integer type, and
the divisor is not zero. This patch also fixes some code that relies on
undefined cast behaviors in C. The modulo operation produces NaN if
either the dividend or divisor is NaN.
2023-07-31 15:39:13 -05:00
Emanuele Torre 6716e23ae6 Declare cfunction.fptr as jv (*)() to avoid having to cast everywhere
You only need to specify the return type in a function pointer
declaration in C.

If you use () in the declaration, the function pointer can be called
with any arguments, and the type of the arguments is decided for each
function call based on the types of the arguments used for the call.
(To declare a function pointer for a function with no arguments, you use
`(void)'.)

Since all the cfunction structs have a  fptr  that points to a functions
that return jv, not void, we can we can just declare cfunction.fptr as
jv (*)()  and avoid having those annoying and technically not C-standard
compliant casts everywhere.
2023-07-31 15:28:01 -05:00
Mattias Wadman f61f842ad0 Massage --help text to use max 72 characters width 2023-07-31 18:05:35 +02:00
Nicolas Williams 69deec63e5 Add new release public key 2023-07-31 10:12:18 -05:00
github-actions[bot] 77c4c8afc5 Update signatures of 1.7rc1 2023-07-31 09:31:05 -05:00
itchyny c8e28da129 Redesign website (#2628)
* Bump up Bootstrap to v5.3.1, Bootstrap Icon to v1.10.5.
* Use autoComplete.js to drop dependency on jQuery and typeahead.js.
* Support dark mode.
* New svg logo and icon with responsive color mode support.
* Normalize section ids to lower kebab-case for easiness of linking.
* Use relative paths for links for local development (--root /output).
* Various markup cleanups and accessibility improvements.
2023-07-31 09:52:52 +09:00
Owen Ou 4af3f99728 Update bug_report.md with Discord link 2023-07-30 04:28:38 +02:00
Owen Ou 82f7f772e6 Redirect questions to Discord
We now have an official Discord server and most maintainers are hanging
out there. It would be a good idea to redirect questions to Discord.
2023-07-30 04:28:38 +02:00
Nicolas Williams f733a1535e Use -Wno-cast-function-type to quiet many warnings 2023-07-30 04:25:54 +02:00
Nicolas Williams c8b30dff4a Add JQ_FALLTHROUGH and use it to quiet warnings 2023-07-30 04:25:54 +02:00
Emanuele Torre a6eb055c47 Fix typo in manual: "-seq" => "--seq" 2023-07-29 18:27:59 -05:00
Owen Ou ee2a215f2e Backfill with references in NEWS.md (#2788)
Backfill with references to PRs & issues in NEWS.md
2023-07-29 07:38:08 -07:00
pkoppstein 70bbd10b0b NEWS.md: tweaks
correct grammar, add attributions, clarify abs
2023-07-28 17:25:41 -05:00
Mattias Wadman 28af007518 Replace NEWS with NEWS.md with more details and examples
Changes mentioned based on picking user facing changes from:
git log --oneline -r master...jq-1.6 | grep -v Merge
2023-07-28 13:43:14 -05:00
pkoppstein 336c3deb8a Test negative indices in path expressions 2023-07-28 12:34:26 -05:00
Nicolas Williams 086a156ec3 Allow .[-1] in path expressions 2023-07-28 12:34:26 -05:00
itchyny d319eb2187 Fix PR creation by using fully qualified refname on release 2023-07-28 17:47:51 +09:00
Emanuele Torre 17889a1a85 Fix memory leak for { $foo: bar }
{ BINDING: ExpD } wasn't freeing BINDING.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60865
2023-07-27 20:59:35 -05:00
itchyny 5b9d0750db Fix PR creation by specifying the branch on release 2023-07-28 10:25:06 +09:00
itchyny b33725c96e Fix gh pr create option on release 2023-07-28 10:04:35 +09:00
itchyny 72f147e82e Fix release job to create a pull request for signatures 2023-07-27 19:18:16 -05:00
itchyny 4160a36fb5 Commit GPG signatures on release 2023-07-27 17:01:24 -05:00
itchyny 668607e305 Enable gamma, drem on macOS 2023-07-26 23:56:01 -05:00
itchyny a1e791acf8 Rename --nul-output to --raw-output0, abort on string containing NUL
The option naming --nul-output was confusing, especially when we have a
similar option for input stream in the future (--nul-input vs --null-input).
Based on the observation of other command line tools, we rename the option
to --raw-output0. We also drop the short option -0 to avoid confusion on
introducing the NUL-delimited input option.

Unlike the other command line tools outputting file names with NUL delimiter,
jq deals with JSON, and its strings may contain NUL character. To protect
users from the risk of injection attacks, we abort the program and print an
error message before outputting strings including NUL character. Closes #2683.
2023-07-26 23:55:00 -05:00
pkoppstein 13fbe98dff manual.yml: remove contingent tests
Also clarify non-prescriptive nature of some tests in jq.test
2023-07-25 23:43:57 -05:00
pkoppstein 7b725378b9 builtin.jq: naive abs/0
manual.yml explains that the def is naive, and mentions fabs, etc.
2023-07-25 23:43:57 -05:00
Emanuele Torre 3a1ba0c42d Only care about RS when parsing with --seq
RS should only only have special meaning when parsing json-seq.
Before this fix, RS was sometimes treated as a value terminator, causing
weird results.

Bug discovered by OSS fuzz.
Ref: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60835
2023-07-25 16:42:32 -05:00
Emanuele Torre ae95864b6b Make sure to free default @text format on error
It seems that bison doesn't call destructors for mid-rule action
components on error, since it does not know their type.

A mid-rule action was used to allocate the "text" string used as format
by string literals without a format, which would leak on error.
This patch replaces it with a new NoFormat component of type <literal>.
Now bison will call jv_free() on that string after a syntax error.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60836

  $ ./jq '"'
  jq: error: syntax error, unexpected end of file, expecting QQSTRING_TEXT or QQSTRING_INTERP_START or QQSTRING_END (Unix shell quoting issues?) at <top-level>, line 1:
  "
  jq: 1 compile error

  =================================================================
  ==1495450==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 21 byte(s) in 1 object(s) allocated from:
      #0 0x7fc21aee1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
      #1 0x557ccb6ff608 in jv_mem_alloc src/jv_alloc.c:141

  SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
2023-07-25 14:51:58 -05:00
Mattias Wadman a949745059 implode: Better invalid input validation and handling
Error on non-number and nan codepoint, would asserd before
Replace negative codepoint and surrogate range with unicode replacement character, would assert before

Fixes #1160
2023-07-25 13:38:41 -05:00
itchyny a29ac81de1 Remove deprecated --argfile option 2023-07-25 10:21:01 -05:00
Mattias Wadman bb8221efdc Align prompt in help example
Was accidentally unaligned in #2747

Now looks like this:

Example:

	$ echo '{"foo": 0}' | jq .
	{
	  "foo": 0
	}

Before looks like this:

Example:

	 $ echo '{"foo": 0}' | jq .
	{
		"foo": 0
	}
2023-07-25 15:10:50 +02:00
itchyny 4705a22c7d Reorder the command line options in the manual (#2766) 2023-07-25 15:24:54 +09:00
pkoppstein 8f49600a6b builtin.jq: simpler and faster transpose (#2758) 2023-07-25 09:12:23 +09:00
Emanuele Torre 330559643a Run autoconf -i in the Build step of the scanbuild workflow
Fixup from 54fef09ac3
2023-07-24 18:55:48 +02:00
Tomas Halman cca0087ee6 Test that jq works in threads
This patch implements test that searches a key in simple
json in pthread.
2023-07-24 11:55:15 -05:00
Tomas Halman 2dbae5610b Fix segmentation fault when using jq in threads
In previous code nomem_handler in jv_alloc.c is called only once
and therefore the structure is not initialized for second and
following threads.

This leads to segmentation fault in multi-threading environment.

This patch moves initialization of nomem_handler out of the
pthread_once call.
2023-07-24 11:55:15 -05:00
itchyny 5300fbda58 Add decnum workflow to test building without decNumber support 2023-07-24 11:53:51 -05:00
itchyny c4d5ba954d Improve USE_DECNUM check position 2023-07-24 11:53:51 -05:00
Mattias Wadman 54fef09ac3 Make maintainer-mode default to disabled
This makes the standard build instructions a bit easier,
just ./configure, and also requires less tools installed (bison).

Also i think few people probably want to generate the lexer and paser code.
2023-07-24 11:26:17 -05:00
Mattias Wadman 4cc99831e4 Free expected value on invalid actual for test
valgrind (3.19.0) locally on macOS docker container seems to detect this leak but not CI.

$ cat modulemeta.test
modulemeta | .deps |= length
"c"
{"whatever":null,"deps":6}

$ valgrind --error-exitcode=1 --leak-check=full -q ./jq --run-tests < modulemeta.test
Test #1: 'modulemeta | .deps |= length' at line number 1
*** Insufficient results for test at line number 3: modulemeta | .deps |= length
0 of 1 tests passed (0 malformed, 0 skipped)
==14129== 482 (392 direct, 90 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 8
==14129==    at 0x48407B4: malloc (vg_replace_malloc.c:381)
==14129==    by 0x13BC78: jv_mem_alloc (jv_alloc.c:122)
==14129==    by 0x1371C6: jvp_object_new (jv.c:1521)
==14129==    by 0x145840: parse_token (jv_parse.c:167)
==14129==    by 0x145840: scan (jv_parse.c:684)
==14129==    by 0x145840: jv_parser_next (jv_parse.c:793)
==14129==    by 0x1463CB: jv_parse_sized (jv_parse.c:865)
==14129==    by 0x136BD9: run_jq_tests (jq_test.c:183)
==14129==    by 0x1370FA: jq_testsuite (jq_test.c:34)
==14129==    by 0x13135C: main (main.c:582)
==14129==
2023-07-24 11:16:22 -05:00
Mattias Wadman 16ae275d4c Fix leaks on invalid input for strftime, strflocaltime and mktime 2023-07-24 16:45:43 +02:00
David Korczynski 97c6d2848c Add fuzzer targeting load_file
Signed-off-by: David Korczynski <david@adalogics.com>
2023-07-24 15:45:12 +02:00
Emanuele Torre 8a4f246876 Remove all #define _GNU_SOURCE in source files
This is unnecessary since we are using AC_USE_SYSTEM_EXTENSIONS in
configure.ac, which makes the compiler always run with -D_GNU_SOURCE=1
when building for GNU/Linux.

Also, the  #define _GNU_SOURCE  in src/util.c, and in
src/inject_errors.c (--enable-inject-errors), were not guarded by a
#ifndef _GNU_SOURCE  so they were just triggering redefinition warnings.
2023-07-24 15:44:29 +02:00
David Korczynski cf3c11bde8 Add compile fuzzer for OSS-Fuzz
Signed-off-by: David Korczynski <david@adalogics.com>
2023-07-24 13:44:27 +02:00
itchyny ed334b536f Improve manual in various ways (inputs, sort_by, foreach sections, etc.) (#2744)
- Add error/0 and mentions null input behavior (close #2231)
- Explain value iterator suffix syntax .foo[] (close #1047)
- Mention array slicing is also zero-based (close #2094)
- Add examples of input and inputs filters (close #2216, close #2470)
- Improve sort_by about multiple values (close #2103, close #2467, close #2474)
- Improve foreach section and simplify examples (close #1148, close #2169)
- Fix recurse/1 document on how it is identical using recurse/2 (close #2036, close #2412)
- Add non-string examples of index/1, rindex/1 (close #1422)
- Simplify the example of truncate_stream/1 (close #1736)
2023-07-24 20:24:44 +09:00
Nico Williams 1cf6515c06 Fix try/catch catches more than it should #1859
Close #1885, #2140, #2011, #2220, #2485, #2073

Rename the FORK_OPT opcode to TRY_BEGIN, add a TRY_END opcode, and wrap
errors when raising through a TRY_END so that they will not be caught by
the matching TRY_BEGIN.

Now a `try exp catch handler` expression generates code like:

    TRY_BEGIN handler
    <exp>
    TRY_END
    JUMP past_handler
    handler: <handler>
    past_handler:
    ...

On backtrack through TRY_BEGIN it just backtracks.

If anything past the whole thing raises when <exp> produced a value,
then the TRY_END will catch the error, wrap it in another, and
backtrack.  The TRY_BEGIN will see a wrapped error and then it will
unwrap and re-raise the error.

If <exp> raises, then TRY_BEGIN will catch the error and jump to the
handler, but the TRY_BEGIN will not stack_save() in that case, so on
raise/backtrack the TRY_BEGIN will not execute again (nor will the
TRY_END).
2023-07-24 13:20:21 +02:00
itchyny 98f709d0c1 Fix stderr to output string with no decoration (fix #2063) 2023-07-23 17:06:00 -05:00
itchyny dfdce8c6e7 Add checksum signature of old release artifacts (close #1999) 2023-07-23 12:24:59 -05:00
Nicolas Williams f64ef1a7d7 Fix --stream-errors w/o --stream, and doc+test (close #2748) 2023-07-23 03:33:28 -05:00
itchyny 123c780607 Enable significand on macOS 2023-07-23 03:28:07 -05:00
itchyny 99a381b5aa Improve --help to mention all the command options 2023-07-23 03:26:44 -05:00
itchyny 575372222a Add importlib_resources dependency for older Python (fix #2753) (#2754) 2023-07-23 15:01:16 +09:00
itchyny 34629ed223 Fix manual source code to follow the schema definition 2023-07-22 19:00:16 -05:00
itchyny 9044f540bb Validate manual schema 2023-07-22 19:00:16 -05:00
itchyny c9c45d7f03 Add tests for --arg, --argjson, and similar options 2023-07-22 12:29:24 -05:00
itchyny 649d6b5f5e Update AUTHOR for the next release 2023-07-22 11:53:43 -05:00
itchyny e0e1b2293e Enable verbose output of make check 2023-07-21 19:49:48 -05:00
itchyny 3ed928954a Fail quickly if not in git repository in scripts/version 2023-07-21 08:59:17 -05:00
itchyny 4732dd82c0 Remove AppVeyor configuration (#2741) 2023-07-21 22:45:45 +09:00
pkoppstein 3553a9d617 manual.yml: some clarifications plus fixes for markdown bloopers (#2737) 2023-07-21 21:33:03 +09:00
itchyny 7c2bf9bd17 Clarify the Docker image location (close #1864) (#2740) 2023-07-21 20:42:11 +09:00
itchyny 99a77f724b Add a regression test for #2000 2023-07-21 09:01:28 +09:00
William Langford 515260213c Increment nlocals when compiling STORE_GLOBAL ops (#2000)
These are stored in vars, so we need to make sure that nlocals is large
enough to account for that
2023-07-21 09:01:16 +09:00
pkoppstein 3ec66c858c manual.yml: revise section on identity, clarifying what is subject to change
Mostly clarifications w.r.t. numbers.

The anomalous behavior of leading minus signs is documented, with an explicit notice that this will probably change.
2023-07-19 22:32:24 -05:00
Robert Aboukhalil a192e647c5 Move options to main and pass it to process 2023-07-19 13:07:46 -05:00
Robert Aboukhalil 4c25cf3f7c Reset options to 0 so can call main() multiple times in a row 2023-07-19 13:07:46 -05:00
itchyny f1c49473a3 Avoid getpwuid for static linking 2023-07-19 09:56:41 -05:00
itchyny f0306405c1 Add notes on NO_COLOR environment variable to the manual 2023-07-19 09:56:01 -05:00
itchyny 0615d4982c Respect NO_COLOR environment variable to disable color output 2023-07-19 00:05:41 -05:00
itchyny 87e3dfddb8 Enable valgrind in oniguruma workflow 2023-07-19 06:45:09 +02:00
0b558f6ed4 Make object key color configurable (close #1739, #1791, #2638)
Co-authored-by: David Haguenauer <ml@kurokatta.org>
Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
2023-07-18 17:53:29 -05:00
Emanuele Torre 62d65a8a9c Fix memory leaks in --with-oniguruma=no implementation of f_match
Found by LeakSanitizer running  ./jq -n '"" | test("")'  in a
--with-oniguruma=no --enable-ubsan --enable-asan  build.
2023-07-18 14:45:20 -05:00
itchyny 0e3c3913d8 Add oniguruma workflow to test regex options 2023-07-18 14:28:16 -05:00
Emanuele Torre 7ffb7943d4 Fix signed integer overflow undefined behaviour in decNumber.c
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60691

  $ ./jq <<< 0E2202012202
  src/decNumber/decNumber.c:598:18: runtime error: signed integer overflow: 440402440 + 1761609760 cannot be represented in type 'int'
  0E+999999999

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60683

  $ ./jq <<< 5E7657765755
  src/decNumber/decNumber.c:598:18: runtime error: left shift of 765776575 by 3 places cannot be represented in type 'int'
  src/decNumber/decNumber.c:598:18: runtime error: signed integer overflow: 1531553150 + 1831245304 cannot be represented in type 'int'
  1.7976931348623157e+308
2023-07-18 14:03:40 -05:00
Emanuele Torre 15fd31de78 Define examples in the "examples" field instead of "example"
Only examples defined in the "examples" field are generated, if they are
defined in "example", they are just ignored.

Also fix a bunch of incorrect tests.
2023-07-18 12:12:50 -05:00
Emanuele Torre 01dfd8b86d Populate captures also for zero-width matches
Instead of just using {"captures":[]}.

sub functions are use captures for replacement expressions.
If we don't populate, captures for empty matches, the replacement
expression is run with an empty object as input instead of an object
containing the named captures with "" as value:

* before:

  $ jq -n '"123foo456bar" | gsub("[^a-z]*(?<x>[a-z]*)"; "Z\(.x)")'
  "ZfooZbarZnull"

* after:

  $ jq -n '"123foo456bar" | gsub("[^a-z]*(?<x>[a-z]*)"; "Z\(.x)")'
  "ZfooZbarZ"

---

I also removed a redundant

  result = NULL;
  if (result) {
    ...
  }
2023-07-18 12:12:50 -05:00
Emanuele Torre bb0f898c01 Initialise jq_state->debug_cb{,_data} to NULL
To make debug/0 not call an uninitialised function pointer when using
--run-tests or when using a jq_state on which jq_set_debug_cb() has not
been called.
2023-07-18 12:12:50 -05:00
itchyny 9e4c71558a Split man.test to make tests pass without oniguruma (#2722) 2023-07-18 08:17:21 +09:00
Emanuele Torre 4b3090a9ab Make stream parser error when a non-empty object or array is used as key
Fixes #2463
2023-07-17 13:15:55 -05:00
Emanuele Torre e79335e3a5 Initialise jq_state->input_cb{,_data} to NULL in jq_init()
To avoid causing segmentation faults when  input/1  is called in a
jq_state on which  jq_set_input_cb()  has not been called; e.g. the one
used by  jq --run-tests.

That segfault could also be fixed in run_jq_tests() by calling:

  jq_set_input_cb(jq, NULL, NULL);

But I think it makes sense to just make jq_init() initialise those
values to NULL.

Ref: https://github.com/jqlang/jq/pull/2717#discussion_r1264338841
2023-07-16 00:03:46 -05:00
itchyny 1cb9ba3533 Fix autoreconf warnings 2023-07-16 00:02:46 -05:00
Emanuele Torre 1915b689f7 Fix indices/1 and rindex/1 in case of overlapping matches in strings
Fixes #2433
2023-07-14 23:40:37 -05:00
Emanuele Torre bf4390562f Add workflow that runs tests with valgrind on linux
To hopefully detect when we introduce new memory leaks. :-)
2023-07-15 01:29:13 +02:00
itchyny 24871fb4a3 Fix memory leak on halt_error/1 2023-07-14 13:39:21 +02:00
pkoppstein 07ef97c414 debug/1 (#2710)
* debug/1

This def ensures the output of debug(m1,m2) is kept together.

Closes #2709 #2111 #2112
2023-07-14 00:17:42 +02:00
Emanuele Torre 4b1ac7c95f Parse nan in JSON as NaN instead of triggering a parse error (#2712)
* Fix memory leak for has(nan)

jv_array_get() used to be responsible of freeing the input array, but
since b5c4c3d67d, it is no longer called
if the key is nan. We need to free it manually to avoid leaking the
array.

* Parse  nan  in JSON as NaN instead of triggering a parse error

Fixes #2021
2023-07-14 07:12:27 +09:00
itchyny 092fef740a Make sure distcheck passes and run dist job on Pull Request 2023-07-13 10:20:04 -05:00
itchyny 481167c8f1 Update jinja2 to fix deprecation warnings on building website (#2711) 2023-07-14 00:06:53 +09:00
itchyny 689a4e660b Fix uri format to follow RFC 3986 (#2157) 2023-07-13 23:23:23 +09:00
Emanuele Torre 55249e29be Also run manpage.yml workflow on pull requests that modify the manual 2023-07-13 06:20:11 +02:00
Emanuele Torre ab2779e2e5 Mark src/decNumber/** as vendored files
This excludes those files from the Languages statistics on github.
2023-07-12 11:14:39 -05:00
itchyny b5c4c3d67d Fix has(nan) on arrays to output false 2023-07-12 09:40:05 -05:00
itchyny 14e5e630ed Revert unexpected changes in decNumber code (ref #2031) 2023-07-11 18:36:36 -05:00
Emanuele Torre c99981c5b2 Update "tests/man.test" and remove superflous whitespace in manual.yml
tests/man.test was generated incorrectly and had some duplicate tests,
the new CI workflow didn't like that.
2023-07-11 00:24:50 -05:00
Emanuele Torre c049061084 Fix build_manpage.py with newer markdown versions
The markdown python changed its API for markdown extensions.

Bumping the markdown package version in previous commits broke
docs/build_manpage.py since it was using registering an extension with
the old API.
2023-07-11 00:24:50 -05:00
Emanuele Torre 83d4dd16ad Add CI workflow to make sure the man page and man.test can be built
And that man.test is up to date.
2023-07-11 00:24:50 -05:00
Owen Ou 4ff63d9365 Add checksums.txt for release
Add checksums.txt for release
2023-07-10 23:59:07 -05:00
itchyny 4c125c7ca6 Do not remove manpage prebuild file on build failure 2023-07-10 18:47:14 -05:00
Emanuele Torre 2377972dfe Use jinja2 ==3.0.2 for now
We are using some deprecated jinja2 features that have been removed in
newer versions.
2023-07-10 16:19:52 -05:00
Nicolas Williams 31280c3b50 Revert "Update docs/Pipfile.lock"
This reverts commit 7fba85095b.
2023-07-10 15:33:18 -05:00
Emanuele Torre 7fba85095b Update docs/Pipfile.lock 2023-07-10 15:23:00 -05:00
Emanuele Torre fc1bef0261 Mark generated manual files as linguist-generated=true 2023-07-10 15:23:00 -05:00
Nicolas Williams 295ff72dd0 Update docs/README.md 2023-07-10 14:35:11 -05:00
Nicolas Williams 1ec8be1422 Update tests/man.test 2023-07-10 14:18:27 -05:00
Nicolas Williams 2a67fc377d Update jq.1.prebuilt 2023-07-10 14:12:32 -05:00
davkor 3df8f90c4e Add first fuzzer for integration with OSS-Fuzz.
Signed-off-by: David Korczynski <david@adalogics.com>
2023-07-10 13:57:38 -05:00
Emanuele Torre 6ca7973d49 Allow using { $__loc__ } as shorthand for { __loc__: $__loc__ }
n.b.: { $__loc__: "foo" }  is still not allowed.

$__loc__ cannot be overwritten, and it is always an object.
Using { $x: "foo" } where $x is not a string is an error, so there is
not much of a point in supporting that.
2023-07-10 12:04:54 -05:00
itchyny 841445eea7 Build Docker image using pre-built executables (#2686) 2023-07-10 16:15:01 +09:00
pkoppstein 8345a8a62b manual.yml: further tweaks re map and map_values
Further tweaks, e.g. i.f.o. explicitness:

`map_values(f)` outputs an array if given an array,
or an object if given an object.
2023-07-10 00:06:58 -05:00
pkoppstein 39cf2fb7a6 manual.yml: further tweaks re map and map_values
A more systematic exposition
2023-07-10 00:06:58 -05:00
pkoppstein d710324ef8 manual.yml: clarify explanation of map_values, including description of new behavior
#2466
2023-07-10 00:06:58 -05:00
Owen Ou ce3701fe52 Cross compile for Linux, MacOS and Windows on CI (#2665) 2023-07-10 08:05:25 +09:00
Emanuele Torre 193f432e08 Lex $foo as a single token, instead of using '$' IDENT
Previously, bindings were parsed as the combination of two tokens:
  '$' IDENT

This meant that using a keyword as variable name (e.g. $then, $label)
did not work.
Attempts were made to allow $keyword to work by adding some '$' Keyword
rules in the parser, but this did not allow $keyword in all places:

  jq --arg label foo -n '$label'  # ok

  jq -n '"foo" as $label | .'     # error

Treating $foo as a single token is much simpler, in my opinion.

This patch also changes how LOC is lexed: "$__loc__" instead of as
"__loc__" that gets combined with '$' in the parser.

This patch also disallows having spaces after '$' when recalling a
variable  `$ foo'  since that was probably just an unintentional side
effect of the implementation, and it was not documented.

Fixes #2675
2023-07-09 17:23:19 -05:00
Emanuele Torre c08ecbaf23 Mark src/{parser,lexer}.{c,h} as generated files in .gitattributes
This should hide edit to those files in PR diffs making PRs easier to
review.
2023-07-09 14:38:17 -05:00
itchyny 600e602548 Fix empty regular expression matches (fix #2565) 2023-07-09 12:51:53 -05:00
itchyny cac216a39c Fix manual on paths/1 to use boolean filter for its argument 2023-07-09 10:54:13 -05:00
Mattias Wadman ab1a68144d Support .a.[] and .a.[]? each syntax
Fixes #1699
2023-07-09 10:08:31 -05:00
itchyny d8072564c2 Fix nth/2 to emit empty on index out of range 2023-07-08 23:13:15 -05:00
itchyny e2bc8de8bb Fix the latest manual on string multiplication by zero 2023-07-08 23:10:07 -05:00
itchyny cac3ea3726 Fix string multiplication by 0 (and less than 1) to emit empty string 2023-07-08 22:25:22 -05:00
itchyny 88b45771bd Fix string multiplication with a value between 0.0 and 1.0
This commit fixes a regression of 6306ac8966.
2023-07-08 22:25:22 -05:00
itchyny af57893bc2 Optimize appending deletion path in modify 2023-07-07 20:11:10 -05:00
itchyny 371abc73ba Fix deletion using assigning empty against arrays (fix #2051) 2023-07-07 20:11:10 -05:00
Emanuele Torre cd8898d5b9 exit immediately after halt or halt_error is called
Instead of continuing to the next input, and only exiting if there are
no more inputs.

Closes #2533
2023-07-07 11:13:28 -05:00
itchyny 0ecededefa Remove deprecated filters: leaf_paths, recurse_down 2023-07-07 10:53:40 -05:00
itchyny 6944d81bc8 Fix dumping large floating numbers (fix #2367) (#2661) 2023-07-06 21:44:17 +09:00
pkoppstein c68ad08805 manual.yml: pick(pathexps)
Change formal parameter name
2023-07-05 23:48:31 -05:00
pkoppstein 37225a9a07 builtin.jq: def pick(pathexps):
Change the name of the formal parameter.
2023-07-05 23:48:31 -05:00
pkoppstein 416e8ada7d builtin: add pick(stream)
pick(stream) works on both arrays and objects

Restrictions on the dot-paths are specified in manual.yml

See #2578
2023-07-05 23:48:31 -05:00
itchyny a881532b29 Fix exit code on JSON parse error (#2654) 2023-07-06 10:01:59 +09:00
Mattias Wadman 95625c3fdb Validate JSON for --jsonarg
Fixes #2572
2023-07-05 16:30:14 -05:00
itchyny c077b95ba2 Remove outdated CI badges from README.md (#2653) 2023-07-05 07:51:25 +09:00
itchyny 9014c212e8 Release Docker image to GitHub Container Registry (#2652) 2023-07-05 04:33:57 +09:00
itchyny 886a9b18b1 Make 0 divided by 0 results in NaN consistently (#2253) 2023-07-05 04:28:08 +09:00
Mattias Wadman dfd440f0de Setup path correctly after stream parsing a key:value object pair (#2642) 2023-07-05 04:23:52 +09:00
itchyny 7d424fd52e Fix release workflow tag trigger pattern (#2651) 2023-07-04 16:00:25 +09:00
itchyny 2270e208d2 Improve Dockerfile: update base image and optimize image size (#2649)
Also, drop ineffectual flags from configure.
2023-07-04 16:00:04 +09:00
Mattias Wadman 12ce4e3b54 Support optional else-branch for if-then-elif-end (#2598) 2023-07-04 07:51:29 +09:00
itchyny 4dc2a2fb9d Implement scan/2 filter (#1961) 2023-07-04 07:48:29 +09:00
pkoppstein 83f375cc83 Revamp sub/3 to resolve most issues with gsub (and sub with "g") (#2641)
The primary purpose of this commit is to rectify most problems with
`gsub` (and also `sub` with the `g` option), in particular fix #1425 ('\b'),
fix #2354 (lookahead), and fix #2532 (regex == `"^(?!cd ).*$|^cd "`).

This commit also partly resolves #2148 and resolves #1206 in that
`gsub` no longer loops infinitely; however, because the new `gsub`
depends critically on `match/2`, the behavior when regex == `""` is
sometimes non-standard.

The documentation has been updated to reflect the fact that `sub`
and `gsub` are intended to be regular in the second argument.

Also, `_nwise/1` has been tweaked to take advantage of TCO.
2023-07-04 07:46:29 +09:00
itchyny edb0d88e3b Fix duplicate entry in .gitignore 2023-07-03 23:05:51 +09:00
itchyny 3847ebb699 Create dist and upload on release also disable docs on build (#2648) 2023-07-03 21:05:21 +09:00
pkoppstein 3c76a5b3f3 manual.yml: fix references to javascript, and clarify semantics of == (#2645)
remove inaccurate and confusing references to javascript; clarify semantics of ==
2023-07-03 12:35:41 +09:00
itchyny 4b5fcb936f Fix the default search paths and documentation (#2093) 2023-07-03 09:12:22 +09:00
itchyny 5ae04c0f52 Strip debug information from executables (fix #1221) (#2647) 2023-07-03 08:46:35 +09:00
Owen Ou 44a0f3448a Release pipeline (#2620)
* Release pipeline

* Group CI builds for different OSes into `ci.yml`.
* Add release job to release `jq` when tag is in the format of v*.
* Use `clang` as the only compiler on CI.
* Provide extensible matrix for future cross-compile builds, e.g.
  for https://github.com/jqlang/jq/pull/2618.

* Locate bison for Windows build

* Also install flex for Windows build

* Add matrix to test all available GH Actions images

* Enable all tests for Windows

* Run `brew update-reset` when `brew update` fails

`brew update` can fail for "Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!"

Ref: https://github.com/owenthereal/jq/actions/runs/5432314910/jobs/9879266028#step:3:19

* Select gcc binaries to release

* Only enable CI when push to master & tag

* Try out statick build

* No need to enforce the same `AM_INIT_AUTOMAKE` version for MacOS

* Disable static build for ubuntu-20.04

See https://github.com/jqlang/jq/pull/2620#discussion_r1248936822
2023-07-02 10:48:26 -07:00
itchyny f88c4e5888 Move an example to the manual and regenerate man.test (#2639) 2023-06-30 07:45:29 +09:00
itchyny 03db5509cb Remove unused function: jv_mem_invalidate, jv_mem_uninit_setup (#2636) 2023-06-28 22:59:41 +09:00
Allan Clark d5dd41e2dc fix: tarball fails distcheck: add files missing from manifest (#2538) 2023-06-28 22:37:49 +09:00
itchyny d829524680 Remove deleted README file from jq.spec (#2637) 2023-06-28 22:37:31 +09:00
itchyny 6d694a4a58 Validate module metadata to be an object (#2357) 2023-06-28 17:59:46 +09:00
itchyny 5dacc6b3a1 Fix bison warnings on incompatibilities with POSIX Yacc (#2634) 2023-06-28 17:56:53 +09:00
itchyny 82d5602230 Fix "writing output failed" error of non ASCII output on Windows (#2633) 2023-06-28 17:54:40 +09:00
itchyny 7c1efd67ff Update oniguruma submodule (June 2023) (#2635) 2023-06-28 17:04:42 +09:00
itchyny 98835eec24 Fix halt_error to print message without prefix in raw mode (fix #1902) (#2632) 2023-06-27 07:33:21 +09:00
itchyny e468eaa396 Fix glibc warning about _BSD_SOURCE and redefined _GNU_SOURCE (fix #1978) (#2631) 2023-06-27 07:25:55 +09:00
itchyny 44c89ad3da Ignore error of outdated manual test when docs disabled (fix #2310) (#2630) 2023-06-27 07:25:24 +09:00
itchyny 73966c80ec Fix number lexer to avoid conflict with object indexing (#2254) 2023-06-27 07:24:49 +09:00
itchyny fac5553b22 Fix overflow exception of the modulo operator (fix #1176) (#2629) 2023-06-27 07:23:41 +09:00
itchyny 6864aa8630 Fix manual section titles, minor typos, and improve inline codes (#2626) 2023-06-22 08:31:38 +09:00
Alex Jurkiewicz dd5ce98caf Document length for numbers and bools (#2625)
This was added in ae7a042876 but not explicitly documented.
2023-06-21 18:21:39 +09:00
itchyny 9a590427db Improve Download page: drop versions for each package manager (#2619) 2023-06-20 08:23:42 +09:00
Nico Williams f7102e9bed Create SECURITY.md 2023-06-19 00:07:29 -05:00
Dan Church 38b42e537f Fix double-installed doc (#2482)
The README symlink was causing the file to be installed twice in
<DOCDIR>.
2023-06-16 23:11:01 +09:00
Dan Church 076d0a2826 Use autotools standard ${docdir} (#2468)
Specified with `--docdir=<path>`, the `$(docdir)` variable is already
available, and has the same default as what it was being set to.

By specifying it here, it overrides what the `--docdir` option
specifies.
2023-06-16 23:06:34 +09:00
Dawid Ferenczy Rogožan 11d909170e Added usage under Powershell to the manual (#2306) 2023-06-16 22:47:37 +09:00
calpeconsulting c2026f5d9e Fedora link returns 404 (#2067) 2023-06-16 22:03:32 +09:00
Marcin Kłopotek 0567d26923 Add Windows installation via scoop (#2188) 2023-06-16 21:55:29 +09:00
pkoppstein d2f1ddbd5a manual.yml - Perl NG (#2614) 2023-06-16 07:59:48 +09:00
Florian Weimer 52d5988afb C99 compatibility enhancements for the configure script (#2519)
* configure.ac: Enable system extensions

Use AC_USE_SYSTEM_EXTENSIONS to build with _GNU_SOURCE (and similar
macros on non-GNU systems), to avoid an implicit declaration of the
strptime function.  This improves compatibility with future compilers
which do not support implicit function declarations.

* configure.ac: gettimeofday lives in <sys/time.h>

The gettimeofday function is declared in <sys/time.h>, not <time.h>,
according to POSIX and actual systems.  This avoids a configure
probe failure with compilers which do not support implicit function
declarations.
2023-06-14 21:41:04 +09:00
Rob Wills 9cb69ad5a5 Add a note about how to provide positional arguments without confusing the arg parser (#1989) 2023-06-14 08:45:02 +09:00
itchyny 2e5c3f490c Fix regular expression section on PCRE (fix #2439), also improve example format (#2613) 2023-06-14 07:36:06 +09:00
itchyny 433b79dddf Fix version scripts for some shallow clone situations (fix #1549) (#2608) 2023-06-14 07:33:25 +09:00
Josh Soref 5cebe86a7b Fix misspellings (#2609) 2023-06-13 20:01:20 +09:00
Josh Soref bd86ca3002 scanbuild: use ubuntu-latest (#2610) 2023-06-13 13:53:01 +09:00
AJ Jordan 840dc55263 Link to the Onigurama docs (#2355) 2023-06-13 13:49:46 +09:00
Josh Soref 1d69ca636a Fix macOS build - drop python3 (#2612)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-06-12 21:29:47 -07:00
itchyny e5414e6828 docs: Fix coding style of Python scripts using YAPF (#2606) 2023-06-08 19:04:19 +09:00
itchyny fd9da6647c docs: Fix example outputs added in #2391 2023-06-07 21:05:03 +09:00
Benjamin Wuethrich e066172aa1 Add fixes for manual (#2391) 2023-06-07 20:59:07 +09:00
Timothy John Perisho Eccleston a87dca3c87 fix typos in manual.yml (#2102) 2023-06-07 20:58:48 +09:00
Anthony Sottile 6c5c8f2115 fix handling of -0 (#2235) 2023-06-06 20:19:43 +09:00
itchyny b8816caf0a docs: Fix a try-catch example (fix #1558, #1777) (#2605) 2023-06-06 09:03:25 +09:00
Henré Botha df8ee8dd79 docs: fix typo in halt_error example (#2336) 2023-06-06 08:36:46 +09:00
Lucas Trzesniewski b7f9587bb9 docs: clarify split behavior (#2462) 2023-06-06 08:28:57 +09:00
Stefan 90bfa96249 Fixed typo in errors on missing some mathematical filters (#2434) 2023-06-06 06:59:29 +09:00
nmulcaheyanditchyny d178ebdc94 [docs] Use yaml.safe_load() in build_*.py scripts (#2432)
Co-authored-by: itchyny <itchyny@cybozu.co.jp>
2023-06-06 06:47:42 +09:00
Matti Åstrand b7511b9b1f Key should be "foo" without spaces (#2212) 2023-06-06 06:17:35 +09:00
itchyny c815794e4b Replace find with select function as the example of jq-coded functions (#1962) 2023-06-06 06:09:03 +09:00
itchyny 4e9a1a8037 Show missing backslash in manual (#2492) 2023-06-06 06:03:58 +09:00
zstadler a5ba98a55c Show missing backslash in manual (#2492) 2023-06-06 06:03:07 +09:00
itchyny d57a96e3f7 Fix website generation workflow 2023-06-06 05:57:31 +09:00
eitsupi 360cd8dbe2 docs: install via winget (#2600) 2023-06-06 05:52:09 +09:00
itchyny cd4dc1e6d1 Add a GitHub Actions workflow to build and update website (#2603) 2023-06-06 05:51:33 +09:00
itchyny 527ea012f3 Remove TravisCI configuration file and fix GitHub actions badges (#2602)
* Remove TravisCI configuration file

* Update CI badges in README.md to refer to GitHub Actions
2023-06-06 05:51:08 +09:00
itchyny 019a9ffbee Improve docs of optional indexing syntax to make it clear (ref #2588) (#2604)
* Revert "Typo in basic filters manual (#2588)"

This reverts commit 908f5d54a7.

* Improve docs of optional indexing syntax to make it clear
2023-06-06 05:43:06 +09:00
Benoit de ChezellesandOwen Ou 908f5d54a7 Typo in basic filters manual (#2588)
Co-authored-by: Owen Ou <169064+owenthereal@users.noreply.github.com>
2023-06-04 22:29:55 -07:00
Tom WolfandOwen Ou 91d10c556b docs: Update Flex URL (#2582)
Co-authored-by: Owen Ou <169064+owenthereal@users.noreply.github.com>
2023-06-04 22:29:36 -07:00
Hanson CharandHanson Char 13d1930154 Update git submodule commit of oniguruma from 5a24a49 to 078f95e (#2561)
Co-authored-by: Hanson Char <hchar@amazon.com>
2023-06-01 17:59:18 -07:00
Owen OuandNicolas Williams 4975b01a21 Merge old jqlang/jq master to the latest (#2596)
* Try making some GitHub Actions

* GHA: Add OS X, Windows, and Linux w/ scan-build builds

* Add link to discord server

Add link to discord server

* Update Ubuntu to 22.04 for GitHub Actions

* Remove if condition for Ubuntu build

* Fix MacOS OS on GitHub Actions

* Fix python3 package on GitHub Actions

* Disalbe valgrind

Getting failed tests: https://github.com/jqlang/jq/actions/runs/5113866588/jobs/9193542140#step:9:341

* Format file

* Fix macos build

* Fix syntax errors of windows build

https://github.com/jqlang/jq/actions/runs/5114162556/workflow

* Install windows package with choco

* Pin oniguruma to 5a24a49d710a9e3bb8ff11d12e1eae5a9f9df40c

MacOS build [fails](https://github.com/jqlang/jq/actions/runs/5114162555/jobs/9194126677#step:6:3160) due to

```
posix.c:94:3: error: implicit declaration of function 'onig_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  onig_end();
```

The current `oniguruma` revision
6fa38f4084b448592888ed9ee43c6e90a46b5f5c (15 Mar 2017) lacks the following explicit declaration in src/onigposix.h:

```
ONIG_EXTERN int onig_end P_((void));
```

This was added to oniguruma in revision 5a24a49d710a9e3bb8ff11d12e1eae5a9f9df40c (8 Sep 2017).

Ref: https://github.com/jqlang/jq/issues/2381

* Revert windows build to use pacman

* Don't zip jq.exe

* Fixing windows build

* Update .gitattriutes for eol on Windows

* Skip workflow_dispatch for windows build

* Clean up builds

* Use LF line endings for all text

Ref: https://github.com/actions/checkout/issues/135

* Fix test that has rounding error

https://github.com/jqlang/jq/pull/2596#issuecomment-1568498993

* Enable CI for all

---------

Co-authored-by: Nicolas Williams <nico@cryptonector.com>
2023-06-01 10:09:39 -07:00
Stephen Dolan 89caf46a5f Update URLs from stedolan to jqlang 2023-05-28 17:06:31 +01:00
Stephen Dolan eb610c0323 Fix website build by adding Loader parameter to yaml.load 2023-05-28 16:41:46 +01:00
Mattias Wadman cff5336ec7 docs: Document repeat(exp) 2022-05-26 16:04:32 -05:00
Mattias Wadman f2ad9517c7 Mention -n in IO-section and for input/inputs 2022-05-26 16:02:50 -05:00
Tomas Halman c4d39c4d22 Fix iterration problem for non decimal string
When the string transformation to number failed, all following
transformation failed too.

This happend because status in decNumberFromString function is
updated just in error case. Reusing the DEC_CONTEXT that failed
before results into error even if the string is valid number.
2022-05-26 16:02:10 -05:00
Naïm Favier 174db0f935 docs: point to Libera.Chat instead of Freenode 2022-05-26 16:01:25 -05:00
Lukas Lansky 29cf77977e Missing "va_end" call. This was found by running the cppcheck static analysis where it shows as error. 2022-05-26 15:53:59 -05:00
Sean Wei 55e6e2c218 Add --recursive to git clone 2022-05-26 15:47:24 -05:00
Zhaohui Mei 88116ba76d docs(manual): fix the typo errors in the manual 2022-05-26 15:47:02 -05:00
Mattias Wadman 3678822e7f docs: Fix some format inconsistencies in manual 2022-05-26 15:46:40 -05:00
Gijs Kunze 0171a9eb60 fixes incorrect example in man page 2022-05-26 15:45:52 -05:00
dak180 edacc8f70d jq is now available through fink. 2022-05-26 15:45:08 -05:00
Ikko Ashimine 2a3e4cf7b2 Fix typo in compile.c
alrady -> already
2022-05-26 15:44:12 -05:00
Stefan 94e87c9377 Fixed typos 2022-05-26 15:43:55 -05:00
Owen Ou f9afa950e2 Update AUTHORS 2022-04-04 12:04:12 -05:00
Owen Ou 6c24c71ddb Update my contributor info
My GitHub profile is at https://github.com/owenthereal
2022-04-04 12:04:12 -05:00
Nicolas Williams a9f97e9e61 Fix accidentally quadratic behavior in _modify
We need to be careful to not grab an extra reference when mutating data
structures because that means we make extra copies.  Doing that every
time in `_modify` is really painful, as that function implements `|=`
and all modify-assign operators.

`jv_setpath()` also grabs additional references, so this is not the only
fix needed for the modify-assign operators to not be accidentally
quadratic.

We have to use `LOADVN` in order to make this fix possible, so we should
really byte-code `_modify` rather than jq-code it.  However, as a
stop-gap to make this fix easier, I'm adding syntax for referring to a
`$binding` such that you get `LOADVN` instead of `LOADV`.

This syntax is not meant to be used outside jq's internals!  Therefore
it is not documented.  I promise to break it later, so don't use it!

TBD, but later:

 - Optimize `_modify` for the case where `update` outputs more than one
   value.

   This is trivial: add a `setpath($p; null)` in the middle of `_modify`
   before calling `update`.  But unfortunately the VM retains a
   reference to `value_at_path` for path expression checking, and fixing
   that will require more work.
2021-10-24 16:23:26 -05:00
Nicolas Williams 0c3455d329 Fix accidentally quadratic behavior in setpath
We need to be careful to not grab an extra reference when mutating
data structures because that means we make extra copies.  Doing that
every time in `jv_setpath()` is really painful, as that function is used
in `_modify/2`, which is used in `|=` and all modify-assign operators.

`_modify` also grabs additional references, so this is not the only fix
needed for the modify-assign operators to not be accidentally quadratic.
2021-10-24 16:23:26 -05:00
Nicolas Williams 1a1804afcb Fix LOADV/LOADVN refcount printing 2021-10-24 16:23:26 -05:00
Nicolas Williams 582717a7b4 Fix crash in LOADVN when stack grows
This `stack_push()` call in LOADVN invalidates `var`:

       jv* var = frame_local_var(jq, v, level);
       jv_free(stack_popn(jq));
------>stack_push(jq, *var);
       *var = jv_null();
       ^^^^^^

We have to re-compute `var`:

       jv* var = frame_local_var(jq, v, level);
       jv_free(stack_popn(jq));
       stack_push(jq, *var);
------>var = frame_local_var(jq, v, level);
       *var = jv_null();
2021-10-24 16:23:26 -05:00
Nicolas Williams 07dc653ae1 Appveyor: Get Appveyor building again 2021-10-24 16:23:26 -05:00
Nicolas Williams d79fe7fd58 Update docs/Pipenv.lock 2021-10-24 16:23:26 -05:00
Nicolas Williams a9ce7244b4 Fix Windows build for 1.7 release (moar) 2021-09-06 22:17:57 -05:00
Nicolas Williams 34182cca7b Fix Windows build for 1.7 release (pthread stuff) 2021-09-03 14:18:18 -05:00
itchyny d18b2d078c Fix msys2 installation on AppVeyor
Ref: https://www.msys2.org/news/#2020-06-29-new-packagers
2021-05-01 14:34:26 -04:00
Mattias Wadman cc4efc49e1 Fix incorrect if empty string example 2021-05-01 14:33:01 -04:00
mjarosie e615bdc407 update the version available through Chocolatey 2021-05-01 14:32:38 -04:00
Aleksey Tsalolikhin 9600a5c781 Re-apply patch from ff8924ce16 to dev manual 2021-05-01 14:19:45 -04:00
Aleksey Tsalolikhin d57d9737d7 Remove decimal number text from v1.6 manual 2021-05-01 14:19:45 -04:00
Ciaran McNamara 2de3bc3732 Add large file support for 32-bit systems to fix issue 2167 2021-05-01 14:17:41 -04:00
William Langford 77417c1335 Clean up compile warnings on macOS 2020-12-19 15:18:29 -05:00
William Langford e660003abf Use AX_PTHREAD to properly detect pthread and flags 2020-12-19 15:18:29 -05:00
Alexandre Jasmin 80052e5275 Fix #2197 extended regex pattern example 2020-12-18 00:01:19 -05:00
Maximilian Roos a17dd3248a Add some missing code quoting to the manual 2020-06-08 12:35:13 -04:00
itchyny 6306ac8966 Reduce allocation on string multiplication 2020-05-26 12:30:27 -04:00
itchyny 9163e09605 Fix multiple string multiplication 2020-05-26 12:30:27 -04:00
itchyny 15fa1dec99 Fix error handling in strftime 2020-05-26 12:29:34 -04:00
Christopher Degawa ccc79e592c Makefile: prepend srcdir to jq.1.prebuilt to fix out of source compilation 2020-03-03 11:50:04 -05:00
William Langford 50a7022ea6 Rework pipenv requirement to be more relaxed
Keep a cached copy of the man tests that we can use when no manpage
changes are made. This allows automated systems that might not have
easy access to a pipenv to build and run tests.
2020-03-02 11:05:43 -05:00
William Langford 8c61ebad0a Minor fixes to website generation 2020-03-02 10:55:51 -05:00
Gustav d24c3d2263 Change Homebrew version in docs to 1.6 2020-03-02 10:10:08 -05:00
Alanscut 63b5c7b553 compatibiltiy->compatibility 2020-03-02 10:05:32 -05:00
Alanscut 5b9e63e4af fix typos 2020-01-14 10:18:22 -06:00
Yoichi Nakayama 503fae5dc9 remove unused conditional branch
It has no effect after the change c4524da.

Bug reported by the clang static analyzer.

Description: Value stored to 'value' is never read
File: jq/src/util.c
Line: 439
2020-01-10 12:01:08 -06:00
Bernard Niset 087100183c Add information on how to install on OS X with MacPorts 2020-01-07 23:35:19 -06:00
William Chargin baecf2ce9e docs: --indent value has maximum of 7, not 8
Test Plan:
To verify that this is in fact the behavior:

```
$ jq --indent 7 -n '[1]'
[
       1
]
$ jq --indent 8 -n '[1]'
jq: --indent takes a number between -1 and 7
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq
```

This patch was generated by running `git grep "no more than"` and fixing
up appropriate results.

wchargin-branch: docs-fix-indent-bounds
2020-01-07 23:34:52 -06:00
Alanscut e7d37983c4 outputing -> outputting 2020-01-03 09:56:04 -06:00
David Biesack 07b18a33fe Update other manual and source to use ;37 2020-01-02 15:47:26 -06:00
David Biesack cf615152e1 correct the default JQ_COLORS to use 37, not undefined color 39 2020-01-02 15:47:26 -06:00
Alanscut fa3733cc4c fix typos 2020-01-02 10:52:12 -06:00
Bradley Skaggs 82987df98d Improve formatting of flags and link to specific wiki article for cross-compilation. 2020-01-02 10:33:35 -06:00
MCApollo 839316e66b compile-ios.sh: realpath is not a default command. 2019-12-30 17:48:45 -06:00
MCApollo d235e97f5e compile-ios.sh: Update grammar 2019-12-30 17:48:45 -06:00
MCApollo 4c2e63a658 Updated compile-ios.sh script. 2019-12-30 17:48:45 -06:00
Paul Wise 24564b2d34 Add -0 / --nul-output option for processing values containing newlines
Closes: https://github.com/stedolan/jq/issues/1271
2019-12-30 15:37:14 -06:00
Felix Wolfsteller 707022b0e5 Rephrase doc "A string B is contained in A" ...
Minor rephrasing to prevent read/brain backtracking when using capital letter A as an article and a variable term.
2019-12-29 23:52:47 -06:00
Richard H Lee 2065d6c3aa Differentiate WIN32 / Cygwin in configure script
shlwapi.h is present on both systems
2019-12-29 19:24:04 -06:00
William Langford e74eab828e Fix nesting try/catch inside internal errors 2019-11-21 17:53:12 -05:00
William Langford bda75c3142 Ensure travis has a python version we expect 2019-10-23 21:31:05 -04:00
Leonid S. Usov 9b51a0852a Remove an accidentally committed debug file 2019-10-22 14:11:04 -04:00
William Langford 74c44bc9a3 Add configure guards around literal jv_numbers
Allow building jq in a mode that doesn't use decnumber for benchmarking
purposes. decnumber support is enabled by default, and this option is
meant to be removed once we're happy with the performance.
2019-10-22 14:11:04 -04:00
Leonid S. Usov 4860ed4396 [tests] print test # from the start of the tests file to help with skip and take 2019-10-22 14:11:04 -04:00
Leonid S. Usov cf4b48c7ba Save literal value of the parsed number to preserve it for the output
Extend jv_number to use decNumber for storing number literals. Any math
operations on the numbers will truncate them to double precision.
Comparisons when both numbers are literal numbers will compare them
without truncation.

Delay conversion of numbers to doubles until a math operation is performed,
to preserve precision. A literal jv_number will only need conversion to
double once, and will reuse the resultant double on subsequent
conversions.

Outputting literal jv_numbers preserves the original precision.

Add strong pthread requirement to manage contexts/allocations for
converting numbers between their decNumber, string, and double formats.
2019-10-22 14:11:04 -04:00
Leonid S. Usov b6be13d5de Add decNumber library
The library adds support for decimal numbers of arbitrary length.
Downloaded from ICU, under ICU 1.8.1 license
http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip
2019-10-22 14:11:04 -04:00
William Langford 37b2d2129e Merge pull request #1948 from eli-schwartz/no-pacman-sy
docs: fix seriously dangerous download instructions for Arch Linux
2019-07-31 12:20:51 -04:00
Eli Schwartz 78774647e1 docs: fix seriously dangerous download instructions for Arch Linux
The current instructions tell users to perform two actions:
- update the package database
- install the jq package

The only thing users need to or should be doing is actually installing
the jq package -- regardless of which version is being installed.
Guidelines on how to perform system updates are massively out of scope.

In the case of partially performing a system update as a prerequisite
for installing jq, the official guidance from Arch Linux is not to do
this: partial updates are not supported, we refuse to support them, and
anyone who does try to perform them anyway is assumed to know so much
about their system that they clearly do not ever need help from anyone
else (which is a good thing since they won't get it). The result is a
frankensteined system that can only ever be supported by the person who
frankensteined it to begin with. The only reason the package manager
even allows it to occur in the first place is because other
distributions using pacman might have different LTS policies, and
because it would prevent expert users from being in control of their
system, as per the traditional Unix philosophy:

"Unix was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things."

Consequences of performing partial updates without understanding the
ramifications in extensive detail can include breaking the partially
updated application (jq), breaking any application that shares a mutual
dependency with the partially updated application (which jq is *lucky*
to only depend on the ever-backwards-compatible glibc), or breaking the
entire operating system by leaving armed traps behind for the next time
a `pacman -S new-package` is executed and thereby breaks *its* cascading
dependencies.

See:
https://wiki.archlinux.org/index.php/System_maintenance#Partial_upgrades_are_unsupported
2019-07-21 14:40:47 -04:00
William Langford a97638713a Merge pull request #1944 from tessus/doc-improvement
clarify filter usage
2019-07-14 15:08:14 -04:00
Helmut K. C. Tessarek 8d9817d2f7 clarify filter usage
The current paragraph is not complete, since a digit is not a special character.

Changing it to:

    If the key contains special characters or starts with a digit,
    you need to surround it with double quotes like this:
    `."foo$"`, or else `.["foo$"]`.
2019-07-08 21:02:43 -04:00
Ricardo Constantino e944fe8436 Makefile.am: fix builtin.inc with out-of-root builds 2019-06-11 11:57:02 -05:00
Mark Feit ad9fc9f559 Improve jv_is_integer() 2019-04-07 14:33:36 -05:00
Mattias Hansson 263e1061ea jq_util_input_init: Zero memory using calloc
Calloc will zero the allocated memory which makes one memset and a
number of explicit zero assignments redundant.
2019-04-04 12:37:21 -05:00
Mattias Hansson 4f58a59f4d Dockerfile: Uninstall oniguruma before distclean
Run `make uninstall` for oniguruma before running the recursive
distclean that will remove oniguruma's Makefile and cause a build error
due to missing make target.
2019-03-29 08:19:41 -05:00
Mattias Hansson 584370127a Dockerfile: Fetch dependency as git submodule
Fetch oniguruma using git submodule instead of a release tarball. It
will fix a build problem, caused by jq's autotools configuration, trying
to run `make distclean` recursively in an empty modules directory. This
will also improve the maintainability of the Dockerfile.
2019-03-29 08:19:41 -05:00
Mattias Hansson 528a4f5945 Dockerfile: Change base image to Debian Stable 2019-03-29 08:19:41 -05:00
Mattias Hansson c4062e09b9 Dockerfile: Add missing dependency to pip3 2019-03-29 08:19:41 -05:00
Mattias Hansson 70e04d6a8e Dockerfile: Specify locale settings
Avoid RuntimeError in pipenv by setting LC_ALL and LANG to C.UTF-8.
2019-03-29 08:19:41 -05:00
Mattias Hansson bcd594ed69 Dockerfile: Set noninteractive
Configure the environment to inform debconf that it's running in
noninteractive mode, to avoid some warnings.
2019-03-29 08:19:41 -05:00
Mattias Hansson 3c4fcb1594 Add pkg-config file for libjq
pkg-config is a common interface to resolve build details. It will
become easier to incorporate libjq in other projects by providing this
interface.
2019-03-29 08:16:36 -05:00
Nicolas Williams b52fc1043b Fix assert in generator subexpressions (fix #1875)
Expressions of the form `path(EXPR) | select(GENERATOR)`, where `EXPR`
is a path expression and `GENERATOR` is a generator conditional
expression (e.g., `has("a"), has("b")`) cause an assertion if the
jq_state VM is torn down too soon.  That assert() was only correct if
assuming that the conditional is not a generator.

If the conditional is generator, then what we see is that when
backtracking a SUBEXP_END is executed without a corresponding
SUBEXP_BEGIN because the entire conditional is bracketed with
SUBEXP_BEGIN and SUBEXP_END, and since it's resumed in the middle, in
between the brackets.

Rather than assert that the jq->path_len being restored has some
particular value, we can simply re-compute it from the restored
jq->path.
2019-03-26 18:58:55 -05:00
Nicolas Williams b34af08f67 Fix tests/jq.test for c72ed135 2019-03-25 09:56:53 -05:00
Nicolas Williams e01398c9db Fix tests/shtest broken by 2b4d51f 2019-03-25 09:52:42 -05:00
Nicolas Williams dffba62e13 Disable docs by default; don't mantest if no docs 2019-03-24 23:36:50 -05:00
Nicolas Williams 2b4d51f697 Identify progname in more errors (fix #1860)
However, we should really use the argv[0] progname, not just jq.
Someday we may want to support aliases which automatically add certain
options, etc.
2019-03-24 23:36:18 -05:00
Nicolas Williams 0dab2b18d7 Add -b / --binary option for Windows 2019-03-24 23:23:16 -05:00
Nicolas Williams 3e0a118886 Allow .["foo"].["bar"] 2019-03-24 23:23:16 -05:00
Nicolas Williams c72ed135e4 Allow keywords in more places (fix #1868) 2019-03-24 23:19:09 -05:00
Muh Muhten 3ea0199e03 Restore cfunction arity in builtins/0
Count arguments up-front at definition/invocation instead of doing it at
bind time, which comes after generating builtins/0 since e843a4f.
2019-02-26 22:39:57 -06:00
Muh Muhten abed751e96 Bind libraries backward for consistent shadowing 2019-02-26 21:57:08 -06:00
Muh Muhten 141bb78e96 Fix regression on ~/.jq being a directory 2019-02-26 21:57:08 -06:00
Muh Muhten 30afc86af1 Fix alpine build 2019-02-26 21:40:59 -06:00
Nicolas Williams 6df393c902 Make shtest verbose 2 diag. alpine build failure
Temporarily(?) make tests/shtest verbose to help diagnose Travis alpine
build failures.
2019-02-26 11:17:20 -06:00
William Langford f951d0241c Change contains to return true for empty string needles
The behavior of memmem for an empty needle is inconsistent between
implementations of libc.
Our tests imply that we want an empty string needle to be true,
so check for an empty needle before calling memmem.
2019-02-26 11:10:38 -06:00
William Langford cc724f105d Configure appveyor build to use python 2019-02-26 11:10:38 -06:00
William Langford a4756fde3f Cleanup leftover references to ruby 2019-02-26 11:10:38 -06:00
William Langford 15be4e7915 Configure travis build to use python 2019-02-26 11:10:38 -06:00
William Langford 53a3f47076 Remove ruby dependency from mantests 2019-02-26 11:10:38 -06:00
William Langford 175dbc4e25 Remove ruby dependency from manpage build 2019-02-26 11:10:38 -06:00
William Langford c1f11855e3 Remove ruby dependency from website build 2019-02-26 11:10:38 -06:00
Muh Muhten 76e72a301d Simplify and optimize SQLish builtins 2019-02-26 11:05:25 -06:00
Muh Muhten a1626adb7e Fix bizarre bsearch/1 behaviour with a stream argument 2019-02-26 11:05:25 -06:00
Muh Muhten d1a07cbdc1 Make tostream much more efficient
(`path(.[])` is a streaming `keys`!)
2019-02-26 11:05:25 -06:00
Muh Muhten 8c1e7175ec Reimplement fromstream/1 more compactly 2019-02-26 11:05:25 -06:00
Muh Muhten fc6df0fdc1 Simplify definition of range/3
New implementation in terms of while/2, and branches immediately on $by
to avoid checking the sign of $by *in* the loop.
2019-02-26 11:05:25 -06:00
Muh Muhten 78271b179a Simplify type-select builtins 2019-02-26 11:05:25 -06:00
Muh Muhten d3abe3a468 Add more tests for any and all 2019-02-26 11:05:25 -06:00
Muh Muhten 41b859325b Redefine isempty/1, and the all and any series
Fixes the bug where all and any evaluate one more item than needed.
2019-02-26 11:05:25 -06:00
Muh Muhten 6a0bdf6063 Remove scalars_or_empty 2019-02-26 11:05:25 -06:00
Muh Muhten 36c250a03d No need to block_drop_unreferenced after builtins
(The correctness of this change is more obvious after the rename.)
2019-02-26 10:49:08 -06:00
Muh Muhten 260879a5c3 Rename block_bind_incremental to block_bind_referenced
block_bind_incremental is block_bind_referenced in a loop backwards. For
an 1-inst block, it does the same thing and isn't too much more
expensive, so it's not really useful to keep both.

Also, block_bind_referenced was a better name for the function.
2019-02-26 10:49:08 -06:00
Muh Muhten 8537b93a43 Fix block flipping in block_drop_unreferenced
Since 605bfb3, block_drop_unreferenced actually reverses the order of
instructions in the block it's run against. This bug was hidden by the
fact that normally it's run *twice* against the main program, flipping
it back, and that order of function definitionss doesn't really matter
after symbol resolution.
2019-02-26 10:49:08 -06:00
220 changed files with 36659 additions and 7193 deletions

No files matched your search

+12
View File
@@ -1,2 +1,14 @@
.gitattributes export-ignore
.gitignore export-ignore
* text=auto eol=lf
# vendored files
src/decNumber/** linguist-vendored
# generated files
src/lexer.[ch] linguist-generated=true
src/parser.[ch] linguist-generated=true
tests/man.test linguist-generated=true
tests/manonig.test linguist-generated=true
jq.1.prebuilt linguist-generated=true
docs/Pipfile.lock linguist-generated=true
+4 -3
View File
@@ -7,7 +7,7 @@ about: Create a report to help us improve
<!--
READ THIS FIRST!
If you have a usage question, please ask us on either Stack Overflow (https://stackoverflow.com/questions/tagged/jq) or in the #jq channel (http://irc.lc/freenode/%23jq/) on Freenode (https://webchat.freenode.net/).
If you have a usage question, please ask us on [Stack Overflow](https://stackoverflow.com/questions/tagged/jq), in the [#jq channel](https://web.libera.chat/#jq) on [Libera.Chat](https://libera.chat/), or in our [Discord server](https://discord.gg/yg6yjNmgAC).
-->
@@ -22,8 +22,9 @@ If the input is large, either attach it as a file, or [create a gist](https://gi
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- OS and Version: [e.g. macOS, Windows, Linux (please specify distro)]
- jq version [e.g. 1.5]
- OS and Version: [e.g. macOS, Windows, Linux (please specify distro)]
- jq version [e.g. 1.5]
**Additional context**
Add any other context about the problem here.
+395
View File
@@ -0,0 +1,395 @@
name: CI
on:
push:
branches:
- master
tags:
- "jq-*"
pull_request:
jobs:
linux:
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
- armel
- armhf
- i386
- mips
- mips64
- mips64el
- mips64r6
- mips64r6el
- mipsel
- mipsr6
- mipsr6el
- powerpc
- ppc64el
- riscv64
- s390x
include:
- arch: amd64
CC: x86_64-linux-gnu
- arch: arm64
CC: aarch64-linux-gnu
- arch: armel
CC: arm-linux-gnueabi
- arch: armhf
CC: arm-linux-gnueabihf
- arch: i386
CC: i686-linux-gnu
- arch: mips
CC: mips-linux-gnu
- arch: mips64
CC: mips64-linux-gnuabi64
- arch: mips64el
CC: mips64el-linux-gnuabi64
- arch: mips64r6
CC: mipsisa64r6-linux-gnuabi64
- arch: mips64r6el
CC: mipsisa64r6el-linux-gnuabi64
- arch: mipsel
CC: mipsel-linux-gnu
- arch: mipsr6
CC: mipsisa32r6-linux-gnu
- arch: mipsr6el
CC: mipsisa32r6el-linux-gnu
- arch: powerpc
CC: powerpc-linux-gnu
- arch: ppc64el
CC: powerpc64le-linux-gnu
- arch: riscv64
CC: riscv64-linux-gnu
- arch: s390x
CC: s390x-linux-gnu
runs-on: ubuntu-22.04
env:
AR: ${{ matrix.CC }}-ar
CHOST: ${{ matrix.CC }}
CC: ${{ matrix.CC }}-gcc
CPP: ${{ matrix.CC }}-cpp
LDFLAGS: -s
SUFFIX: linux-${{ matrix.arch }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y automake autoconf libtool crossbuild-essential-${{ matrix.arch }}
- name: Build
run: |
autoreconf -i
./configure \
--host=${{ matrix.CC }} \
--disable-docs \
--disable-valgrind \
--with-oniguruma=builtin \
--enable-static \
--enable-all-static \
CFLAGS="-O2 -pthread -fstack-protector-all"
make -j"$(nproc)"
file ./jq
cp ./jq jq-${{ env.SUFFIX }}
- name: Test
# Only run tests for amd64 matching the CI machine arch
if: ${{ matrix.arch == 'amd64' }}
run: |
make check VERBOSE=yes
git diff --exit-code
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jq-linux
path: jq-${{ env.SUFFIX }}
if-no-files-found: error
retention-days: 7
macos:
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
include:
- arch: amd64
target: x86_64-apple-darwin
- arch: arm64
target: arm64-apple-darwin
runs-on: macos-13
env:
LDFLAGS: -dead_strip
SUFFIX: macos-${{ matrix.arch }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
# brew update sometimes fails with "Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!"
brew update || brew update-reset
brew install autoconf automake libtool
- name: Set CC
run: |
echo "CC=clang -target ${{ matrix.target }}$(uname -r)" >> "$GITHUB_ENV"
- name: Build
run: |
autoreconf -i
./configure \
--host="${{ matrix.target }}$(uname -r)" \
--disable-docs \
--disable-valgrind \
--with-oniguruma=builtin \
--enable-static \
--enable-all-static \
CFLAGS="-O2 -pthread -fstack-protector-all"
make -j"$(nproc)"
strip ./jq
file ./jq
cp ./jq jq-${{ env.SUFFIX }}
- name: Test
# Only run tests for amd64 matching the CI machine arch
if: ${{ matrix.arch == 'amd64' }}
run: |
make check VERBOSE=yes
git diff --exit-code
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jq-macos
path: jq-${{ env.SUFFIX }}
if-no-files-found: error
retention-days: 7
windows:
strategy:
fail-fast: false
matrix:
arch:
- amd64
- i386
include:
- arch: amd64
msystem: UCRT64
- arch: i386
msystem: MINGW32
runs-on: windows-2022
env:
LDFLAGS: -s
SUFFIX: windows-${{ matrix.arch }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{ matrix.msystem }}
install: >-
base-devel
git
autoconf
automake
libtool
pacboy: >-
toolchain:p
- name: Build
run: |
autoreconf -i
./configure \
--disable-docs \
--disable-valgrind \
--with-oniguruma=builtin \
--disable-shared \
--enable-static \
--enable-all-static \
CFLAGS="-O2 -pthread -fstack-protector-all"
make -j$(nproc)
file ./jq.exe
cp ./jq.exe jq-${{ env.SUFFIX }}.exe
- name: Test
run: |
make check VERBOSE=yes
git diff --exit-code --ignore-submodules
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jq-windows
path: jq-${{ env.SUFFIX }}.exe
if-no-files-found: error
retention-days: 7
dist:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update -qq
sudo apt-get install -y automake autoconf
- name: Create dist
run: |
autoreconf -i
./configure \
--disable-docs \
--disable-valgrind \
--with-oniguruma=builtin
make distcheck
make dist dist-zip
git diff --exit-code
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jq-dist
if-no-files-found: error
retention-days: 7
path: |
jq-*.tar.gz
jq-*.zip
docker:
runs-on: ubuntu-latest
permissions:
packages: write
needs: linux
if: startsWith(github.ref, 'refs/tags/jq-')
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Download executables
uses: actions/download-artifact@v3
with:
name: jq-linux
- name: Move executables
run: |
mkdir -p linux/{386,amd64,arm64,mips64le,ppc64le,riscv64,s390x}
mv jq-linux-i386 linux/386/jq
mv jq-linux-amd64 linux/amd64/jq
mv jq-linux-arm64 linux/arm64/jq
mv jq-linux-mips64el linux/mips64le/jq
mv jq-linux-ppc64el linux/ppc64le/jq
mv jq-linux-riscv64 linux/riscv64/jq
mv jq-linux-s390x linux/s390x/jq
chmod +x linux/*/jq
- name: Create Dockerfile
run: |
cat <<'EOF' >Dockerfile
FROM scratch
ARG TARGETPLATFORM
COPY AUTHORS COPYING $TARGETPLATFORM/jq /
RUN ["/jq", "--version"]
ENTRYPOINT ["/jq"]
EOF
- name: Docker metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ghcr.io/${{ github.repository }}
tags: type=match,pattern=jq-(.*),group=1,value=${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
provenance: false
platforms: linux/386,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/riscv64,linux/s390x
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
environment: release
needs: [linux, macos, windows, dist, docker]
if: startsWith(github.ref, 'refs/tags/jq-')
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Upload release
env:
TAG_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sha256sum jq-*/jq-* | sed 's| .*/| |' > sha256sum.txt
gh release create "$TAG_NAME" --draft --title "jq ${TAG_NAME#jq-}" --generate-notes
gh release upload "$TAG_NAME" --clobber jq-*/jq-* sha256sum.txt
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.JQ_RELEASE_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.JQ_RELEASE_GPG_PASSPHRASE }}
- name: Update signatures
env:
TAG_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sig_dir="sig/v${TAG_NAME#jq-}"
mkdir -p "$sig_dir"
mv sha256sum.txt "$sig_dir"
for file in jq-*/jq-*; do
gpg --detach-sign --armor --batch --output "${sig_dir}/${file#*/}.asc" "$file"
done
git add sig
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
title="Update signatures of ${TAG_NAME#jq-}"
git commit -m "$title"
branch="update-signatures-${TAG_NAME#jq-}"
git push origin "HEAD:refs/heads/$branch"
gh pr create --title "$title" --body "" --head "$branch"
+32
View File
@@ -0,0 +1,32 @@
name: decnum
on:
push:
branches:
- master
pull_request:
jobs:
disabled:
runs-on: ubuntu-22.04
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y automake autoconf libtool
- name: Build
run: |
autoreconf -i
./configure \
--disable-docs \
--disable-maintainer-mode \
--disable-decnum
make -j"$(nproc)"
file ./jq
- name: Test
run: |
diff <(echo 100000000000000000000 | ./jq) <(echo 1e+20)
git diff --exit-code
+51
View File
@@ -0,0 +1,51 @@
name: Building man page, man.test, manonig.test
on:
push:
paths:
- '.github/workflows/manpage.yml'
- 'docs/**'
- 'tests/man.test'
- 'tests/manonig.test'
- 'jq.1.prebuilt'
pull_request:
paths:
- '.github/workflows/manpage.yml'
- 'docs/**'
- 'tests/man.test'
- 'tests/manonig.test'
- 'jq.1.prebuilt'
jobs:
manpages:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pipenv
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies
run: pipenv sync
working-directory: docs
- name: Validate manual schema
run: pipenv run python3 validate_manual_schema.py content/manual/**/*.yml
working-directory: docs
- name: Configure
run: |
autoreconf -i
./configure --enable-docs
- name: Build man page, man.test, manonig.test
run: |
mv jq.1.prebuilt jq.1.old
rm -f tests/man.test manonig.test
make jq.1.prebuilt tests/man.test tests/manonig.test
- name: Make sure that jq.1.prebuilt, man.test, manonig.test are up to date
run: |
git diff --exit-code tests/man.test tests/manonig.test
# skip build date in jq.1.prebuilt
test -s jq.1.prebuilt
diff -- <(tail -n +3 jq.1.old) <(tail -n +3 jq.1.prebuilt)
+73
View File
@@ -0,0 +1,73 @@
name: oniguruma
on:
push:
branches:
- master
pull_request:
# Since builtin oniguruma is tested in the CI workflow,
# we test other options for --with-oniguruma here.
jobs:
installed:
runs-on: ubuntu-22.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y automake autoconf libtool valgrind libonig-dev
- name: Build
run: |
autoreconf -i
./configure \
--disable-docs \
--with-oniguruma=yes
make -j"$(nproc)"
file ./jq
- name: Test
run: |
./jq -n '"" | test("")'
make check VERBOSE=yes
git diff --exit-code
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-oniguruma-installed
retention-days: 7
path: |
test-suite.log
tests/*.log
disabled:
runs-on: ubuntu-22.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y automake autoconf libtool valgrind
- name: Build
run: |
autoreconf -i
./configure \
--disable-docs \
--with-oniguruma=no
make -j"$(nproc)"
file ./jq
- name: Test
run: |
! ./jq -n '"" | test("")'
make check VERBOSE=yes
git diff --exit-code
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-oniguruma-disabled
retention-days: 7
path: |
test-suite.log
tests/*.log
+75
View File
@@ -0,0 +1,75 @@
name: Linux Clang scan-build Static Analyzer Build
on:
# Don't do this for PRs. It eats up minutes.
push:
branches:
- 'master'
- 'scan-build'
paths:
- '.github/workflows/scanbuild.yml'
jobs:
unix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [linux-clang]
include:
- name: linux-clang
os: ubuntu-latest
compiler: clang
cflags: ''
steps:
- name: Clone repository
uses: actions/checkout@v1
- name: Open Submodule(s)
run: |
git submodule update --init --recursive
- name: Install packages
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update -qq
sudo apt-get install -y automake autoconf bison flex gdb python3 valgrind clang-tools
- name: Prep
run: |
#pyenv global 3.6.7
#pip3 install pipenv
#(cd docs && pipenv sync)
#if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
echo SHELL=$SHELL
echo PATH=$PATH
which bison
bison --version
- name: Build
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
autoreconf -i
./configure --with-oniguruma=builtin $COVERAGE
scan-build --keep-going make -j4
- name: Test
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
ulimit -c unlimited
scan-build --keep-going make -j4 check
- name: Core dump stacks
run: |
echo "thread apply all bt" > /tmp/x
find . -name core -print | while read core; do gdb -batch -x x `file "$core"|sed -e "s/^[^']*'//" -e "s/[ '].*$//"` "$core"; done
if [ "$(find . -name core -print | wc -l)" -gt 0 ]; then false; fi
- name: Test logs
if: ${{ failure() }}
run: |
cat test-suite.log
cat tests/*.log
- name: Upload Logs
uses: actions/upload-artifact@v2
with:
name: Scan-Build Reports
path: '/tmp/scan-build*/'
+41
View File
@@ -0,0 +1,41 @@
name: valgrind
on:
push:
branches:
- master
pull_request:
jobs:
linux:
runs-on: ubuntu-22.04
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y automake autoconf libtool valgrind
- name: Build
run: |
autoreconf -i
./configure \
--disable-docs \
--with-oniguruma=builtin
make -j"$(nproc)"
file ./jq
- name: Test
run: |
make check VERBOSE=yes
git diff --exit-code
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-valgrind-linux
retention-days: 7
path: |
test-suite.log
tests/*.log
+40
View File
@@ -0,0 +1,40 @@
name: Update website
on:
push:
branches:
- master
paths:
- 'docs/**'
concurrency: website
permissions:
contents: write
jobs:
website:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pipenv
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies
run: pipenv sync
working-directory: docs
- name: Update website
run: scripts/update-website
- name: Commit changes
run: |
if ! git diff --quiet; then
git add --all
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m 'Update website'
git push origin gh-pages
fi
+7
View File
@@ -18,6 +18,8 @@ jq.1
# Generated source
src/builtin.inc
src/config_opts.inc
*.pc
# Autotools junk
.libs
@@ -32,6 +34,7 @@ autom4te.cache
INSTALL
Makefile
jq-*.tar.gz
jq-*.zip
configure
aclocal.m4
Makefile.in
@@ -46,6 +49,10 @@ m4/ltversion.m4
m4/lt~obsolete.m4
tests/*.trs
# Docs output
docs/output
cscope.in.out
cscope.out
cscope.po.out
jq.dSYM
-202
View File
@@ -1,202 +0,0 @@
sudo: false
language: c
stages:
- name: test
- name: build
# Don't run build stage for pull requests to save time and resources.
if: type != pull_request
jobs:
include:
# Build with gcc and run tests on Ubuntu.
- &test-ubuntu
stage: test
os: linux
compiler: gcc
addons:
apt:
packages:
- valgrind
- bison
- automake
before_install:
- uname -s
- rvm install ruby-1.9.3-p551
- rvm use 1.9.3
- rm src/{lexer,parser}.{c,h}
- sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
install:
- bundle install --gemfile=docs/Gemfile
- wget http://ftp.debian.org/debian/pool/main/b/bison/bison_3.0.2.dfsg-2_amd64.deb
- ar p bison_3.0.2.dfsg-2_amd64.deb data.tar.xz | tar xJ
- if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
before_script:
# If this is OS X we'll get bison from brew, else we'll get bison
# from the .deb unpacked above in the install section.
- PATH=/usr/local/opt/bison/bin:$PWD/usr/bin:$PATH
- echo SHELL=$SHELL
- echo PATH=$PATH
- which bison
- bison --version
- autoreconf -if
- ./configure --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE
script:
# When using the bison from Debian we need to tell that bison where
# to find its data. Yay non-relocatable code. Not.
- echo PATH=$PATH
- which bison
- make BISON_PKGDATADIR=$PWD/usr/share/bison src/parser.c || make src/parser.c
# Make dist!
#
# Make it first to fail the build early, before we test with
# valgrind.
- make dist
# Build and test the dist (without valgrind)
- |
(
tar xvf jq-`scripts/version`.tar.gz &&
cd jq-`scripts/version` &&
pwd &&
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE &&
make BISON_PKGDATADIR=$PWD/usr/share/bison src/parser.c || make src/parser.c &&
make -j4 &&
make check -j4 || true
)
# Build and test the HEAD
- make -j4
- make check -j4
after_failure:
- cat test-suite.log
- cat tests/*.log
# Build with clang and run tests on Ubuntu.
- <<: *test-ubuntu
compiler: clang
# Build with gcc and run tests with gcov on Ubuntu.
- <<: *test-ubuntu
env: COVERAGE="--disable-valgrind --enable-gcov"
after_script:
- rm -rf src/.libs # don't care about coverage for libjq
- coveralls --gcov-options '\-lp'
-e src/lexer.c -e src/parser.c -e src/jv_dtoa.c
# Build with gcc and run tests on macOS.
- &test-osx
<<: *test-ubuntu
os: osx
before_install:
- uname -s
- brew update
- brew install flex bison
- rvm install ruby-1.9.3-p551
- rvm use 1.9.3
- gem install bundler
- rm src/{lexer,parser}.{c,h}
- sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
install:
- bundle install --gemfile=docs/Gemfile
- if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
# Build with clang and run tests on macOS.
- <<: *test-osx
compiler: clang
# Build with gcc and run tests on Alpine Linux v3.7 (inside chroot).
# Note: Alpine uses musl libc.
- &test-alpine
stage: test
os: linux
language: minimal
compiler: gcc
sudo: true
before_install:
- "wget 'https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.7.0/alpine-chroot-install' \
&& echo '090d323d887ef3a2fd4e752428553f22a52b87bb alpine-chroot-install' | sha1sum -c || travis_terminate 1"
- alpine() { /alpine/enter-chroot -u "$USER" "$@"; }
install:
- sudo sh alpine-chroot-install -b v3.7 -a "$ARCH"
-p 'build-base automake autoconf bison libtool oniguruma-dev'
before_script:
- autoreconf -if
script:
- alpine ./configure --disable-docs
- alpine make
- alpine make check
# Build release binary statically linked with musl libc on Alpine Linux
# (inside chroot). If building a tagged commit, then deploy release
# tarball to GitHub Releases.
- &build-alpine
<<: *test-alpine
stage: build
env: ARCH=x86_64
script:
- alpine ./configure --disable-docs --enable-all-static
CFLAGS='-Os -static -no-pie' CXXFLAGS='-Os -static -no-pie'
- alpine make
- alpine strip jq
- jq -V
- ls -lah jq
- file jq
# Ensure that the built executable is really statically linked.
- file jq | grep -Fw 'statically linked'
before_deploy:
- PKGNAME="jq-$TRAVIS_TAG-$ARCH-linux"
- mkdir $PKGNAME && mv jq $PKGNAME/
- tar -czf $PKGNAME.tar.gz $PKGNAME/
- sha256sum $PKGNAME.tar.gz > $PKGNAME.tar.gz.sha256
deploy:
provider: releases
api_key:
secure: # TODO: put encrypted GitHub token here!
file: jq-$TRAVIS_TAG-*.tar.gz*
file_glob: true
skip_cleanup: true
on:
tags: true
# Build binaries for other architectures using QEMU user-mode emulation.
- <<: *build-alpine
env: ARCH=x86
- <<: *build-alpine
env: ARCH=aarch64
- <<: *build-alpine
env: ARCH=armhf
- <<: *build-alpine
env: ARCH=ppc64le
notifications:
email: false
+149 -43
View File
@@ -2,73 +2,179 @@ Created By:
Stephen Dolan <mu@netsoc.tcd.ie>
Maintained by:
David Tolnay <dtolnay@gmail.com>
Emanuele Torre <torreemanuele6@gmail.com>
Leonid S. Usov <leonid@practi.net>
Mattias Wadman <mattias.wadman@gmail.com>
Muh Muhten <muh.muhten@gmail.com>
Nicolas Williams <nico@cryptonector.com>
Owen Ou <o@owenou.com>
William Langford <wlangfor@gmail.com>
itchyny <itchyny@cybozu.co.jp>
pkoppstein <pkoppstein@gmail.com>
Contributions by:
13ren <melbourne.research@gmail.com>
AJ Jordan <alex@strugee.net>
Aaron Peschel <apeschel@zendesk.com>
Adam Lindberg <hello@alind.io>
Alanscut <wp_scut@163.com>
Aleksey Tsalolikhin <atsalolikhin@spokeo.com>
Alex Chamberlain <alex@alexchamberlain.co.uk>
Andrew O'Brien <obrien.andrew@gmail.com> - docs build
Andrew Rodland <andrew@cleverdomain.org> - bug fixes
Ankur <ankz.kothari@gmail.com> - bug fixes
Anthony Shortland <anthony.shortland@me.com> - rpmbuild target
Assaf Gordon <assafgordon@gmail.com> - error handling
Brendan Macmillan <melbourne.research@gmail.com> - bug fixes, load library from ~/.jq
cdnbacon <mike@busbud.com>
Alex Jurkiewicz <alex@jurkiewi.cz>
Alex Ozdemir <aozdemir@hmc.edu>
Alex Wilson <gpg@probablyfine.co.uk>
Alexandre Jasmin <ajasmin@transtex-llc.com>
Allan Clark <allanc@chickenandporn.com>
Andrew O'Brien <obrien.andrew@gmail.com>
Andrew Rodland <andrew@cleverdomain.org>
Andrew Speed <andrew.cspeed@gmail.com>
Ankur <ankz.kothari@gmail.com>
Anthony Shortland <anthony@dtosolutions.com>
Anthony Sottile <asottile@umich.edu>
Assaf Gordon <assafgordon@gmail.com>
Attila Fülöp <attila@fueloep.org>
Benjamin Wuethrich <benjamin@koho.ca>
Benoit de Chezelles <bew@users.noreply.github.com>
Bernard Niset <bernard.niset@gmail.com>
Bradley Skaggs <bskaggs@acm.org>
Brendan Macmillan <melbourne.research@gmail.com>
Cameron Sparr <cameronsparr@gmail.com>
Chance Zibolski <czibolsk@redhat.com>
Charles Merriam <charles.merriam@gmail.com>
Chris Moore <dooglus@gmail.com>
Christopher Degawa <ccom@randomderp.com>
Ciaran McNamara <1372986+ciaranmcnamara@users.noreply.github.com>
Clément MATHIEU <clement@unportant.info>
Colin von Heuring <colin@janrain.com>
Damian Gryski <damian@gryski.com>
David Fetter <david@fetter.org> - added --rawfile
Dan Church <h3xx@users.noreply.github.com>
Daniel Lange <DLange@git.local>
David Biesack <David.Biesack@apiture.com>
David Fetter <david@fetter.org>
David Haguenauer <ml@kurokatta.org>
David R. MacIver <david@drmaciver.com> - bug fixes
David Tolnay <dtolnay@gmail.com> - destructuring, build improvements
Doug Luce <doug@github.con.com> - build
David Korczynski <david@adalogics.com>
David R. MacIver <david@drmaciver.com>
Dawid Ferenczy Rogožan <ferenczy@users.noreply.github.com>
Derrick Pallas <derrick@pallas.us>
Doug Luce <doug@github.con.com>
Eiichi Sato <sato.eiichi@gmail.com>
Eric Bréchemier <eric@egull.co> - bug fix
Filippo Giunchedi <fgiunchedi@gmail.com> - bug fixes
Filippo Valsorda <filippo.valsorda@gmail.com> - recursive object merge (`*`)
Eli Schwartz <eschwartz@archlinux.org>
Eric Bréchemier <eric@egull.co>
Erik Brinkman <erik.brinkman@gmail.com>
Eugen <EugenGez@gmail.com>
Evan Zacks <zackse@gmail.com>
Felix Wolfsteller <felix.wolfsteller@gmail.com>
Filippo Giunchedi <fgiunchedi@gmail.com>
Filippo Valsorda <filippo.valsorda@gmail.com>
Florian Weimer <fweimer@redhat.com>
Frederic Cambus <fcambus@users.sourceforge.net>
Gert Van Gool <gertvangool@gmail.com>
Gijs Kunze <gwkunze@gmail.com>
Gustav <gustav@invoke.se>
HE, Tao <sighingnow@gmail.com>
Hanfei Shen <qqshfox@gmail.com>
i <isomorphisms@sdf.org>
Hanson Char <hanson.char@gmail.com>
Haochen Xie <haochenx@acm.org>
Helmut K. C. Tessarek <tessarek@evermeet.cx>
Henré Botha <henrebotha@gmail.com>
Ian Miell <ian.miell@gmail.com>
Jack Pearkes <jackpearkes@gmail.com> - update tutorial
James Andariese <james.andariese@locationlabs.com> - Dockerfile
Jingwen Owen Ou <jingweno@gmail.com> - jqplay.org and link to it
jkleint <jkleint@gmail.com>
Joe Littlejohn <joe.littlejohn@nokia.com> - bug fixes
Ikko Ashimine <eltociear@gmail.com>
J Phani Mahesh <github@phanimahesh.me>
Jack Pearkes <jackpearkes@gmail.com>
Jakub Jirutka <jakub@jirutka.cz>
Jakub Wilk <jwilk@jwilk.net>
James Andariese <james.andariese@locationlabs.com>
James Pearson Hughes <xiong.chiamiov@gmail.com>
Jan Schulz <jasc@gmx.net>
Janne Cederberg <janne.cederberg@gmail.com>
Jason Hood <jadoxa@yahoo.com.au>
Jay Satiro <raysatiro@yahoo.com>
Jingwen Owen Ou <jingweno@gmail.com>
Joe Littlejohn <joe.littlejohn@nokia.com>
Joel Nothman <joel.nothman@gmail.com>
Joel Purra <code+github@joelpurra.com>
Juan Guerrero <juan.guerrero.lozano@gmail.com> - bug fixes
Kenny Shen <kenny.shen@zalora.com> - doc fixes
Kim De Mey <kim.demey@gmail.com> - build
Jonathan Word <argoday@argoday.com>
Josh Soref <2119212+jsoref@users.noreply.github.com>
Juan Guerrero <juan.guerrero.lozano@gmail.com>
Kenny Shen <kenny.shen@zalora.com>
Kim De Mey <kim.demey@gmail.com>
Kim Toms <kim.toms@bplglobal.net>
LCD 47 <lcd047@gmail.com>
Lee Thompson <stagr.lee@gmail.com> - autoconf stuff, rpm
Larry Aasen <larryaasen@gmail.com>
Lee Thompson <stagr.lee@gmail.com>
Loamhoof <soeren.medard@gmail.com>
Lucas Trzesniewski <lucas.trzesniewski@gmail.com>
Lukas Lansky <lukas.lansky@suse.com>
MCApollo <34170230+MCApollo@users.noreply.github.com>
Marc Abramowitz <marc@marc-abramowitz.com>
Marc Bruggmann <marcbr@spotify.com>
Markus Lanthaler <mark_lanthaler@gmx.net> - doc fixes
Maxime Biais <maxime.biais@gmail.com> - build
Michael Daines <michael@mdaines.com> - add sqrt; doc fixes
Marcin Kłopotek <marcin.klopotek@gmail.com>
Mark Feit <mfeit@internet2.edu>
Mark McKinstry <mmckinst@umich.edu>
Markus Lanthaler <mark_lanthaler@gmx.net>
Matt Clegg <m@cle.gg>
Matti Åstrand <mattiastr@gmail.com>
Mattias Hansson <hansson.mattias@gmail.com>
Maxime Biais <maxime.biais@gmail.com>
Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Michael Daines <michael@mdaines.com>
Mike Daines <mdaines@users.noreply.github.com>
Mike Fletcher <john.m.fletcher@bankofamerica.com>
Mike McCabe <mccabe@archive.org> - math (libm) functions
Nicolas Pouillard <nicolas.pouillard@gmail.com> - add tests
Nicolas Williams <nico@cryptonector.com> - library-fication, autoconf stuff, exception handling, various
Peter van Dijk <peter@7bits.nl> - doc fixes
Philipp Hagemeister <phihag@phihag.de> - doc fixes
pkoppstein <pkoppstein@gmail.com> - various builtins, improvements
polyester <paul@cleanclothes.org> - automake version update
Ryoichi KATO <ryo1kato@gmail.com> - doc fixes
Rémy Léone <remy.leone@gmail.com> - add .travis.yml
Santiago Lapresta <santiago.lapresta@gmail.com> - join, arrays, all, any, other filters
Sebastian Freundt <freundt@ga-group.nl> - build
Shaun Guth <shaun.guth@gmail.com> - base64d
Mike McCabe <mccabe@archive.org>
Naïm Favier <n@monade.li>
Nicolas Pouillard <nicolas.pouillard@gmail.com>
Paul Chvostek <paul+gitkraken@it.ca>
Paul Wise <pabs3@bonedaddy.net>
Peter van Dijk <peter@7bits.nl>
Philipp Hagemeister <phihag@phihag.de>
Rémy Léone <remy.leone@gmail.com>
Ricardo Constantino <wiiaboo@gmail.com>
Richard Groves <richard@noodlfroot.com>
Richard H Lee <richard@webdezign.co.uk>
Riley Avron <riley.avron@gmail.com>
Rob Wills <rob.wills@gmail.com>
Robert Aboukhalil <robert.aboukhalil@gmail.com>
Roland C. Dowdeswell <roland.dowdeswell@twosigma.com>
Roman Inflianskas <rominf@users.noreply.github.com>
Romero Malaquias <romero.malaquias@gmail.com>
Ryoichi KATO <ryo1kato@gmail.com>
Santiago Lapresta <santiago.lapresta@gmail.com>
Sean Wei <me@sean.taipei>
Sebastian Freundt <freundt@ga-group.nl>
Shaun Guth <sguth@practicefusion.com>
Shay Elkin <shay@everything.me>
Simon Elsbrock <simon@iodev.org> - Debian
Simon Elsbrock <simon@iodev.org>
Stefan <stefan.haubenthal@gmail.com>
Stefan Seemayer <stefan@seemayer.de>
Stephen Roantree <stroantree@gmail.com>
Stephen Shaw <stesh@netsoc.tcd.ie>
Steven Maude <StevenMaude@users.noreply.github.com>
Steven Penny <svnpenn@gmail.com> - Windows bug fixes
tal@whatexit.org <tal@whatexit.org>
Steven Penny <svnpenn@gmail.com>
Thomas R. Hall <trhall@trhall.org>
Tim McCormack <cortex@brainonfire.net>
Timothy John Perisho Eccleston <combinatorist@users.noreply.github.com>
Tom Wolf <github@incognitox.org>
Tomas Halman <thalman@redhat.com>
Travis Gockel <travis@gockelhut.com>
W-Mark Kubacki <wmark@hurrikane.de>
William Chargin <wchargin@gmail.com>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
Yoichi Nakayama <yoichi.nakayama@gmail.com>
Zhaohui Mei <mzh.whut@gmail.com>
Zhiming Wang <zmwangx@gmail.com>
13ren <melbourne.research@gmail.com>
calpeconsulting <61429736+calpeconsulting@users.noreply.github.com>
cdnbacon <mike@busbud.com>
dak180 <dak180@users.sf.net>
davkor <david@adalogics.com>
eitsupi <50911393+eitsupi@users.noreply.github.com>
i <isomorphisms@sdf.org>
jkleint <jkleint@gmail.com>
mail6543210 <mail6543210@yahoo.com.tw>
mjarosie <mjarosie@users.noreply.github.com>
nmulcahey <nmulcahey@gmail.com>
polyester <paul@cleanclothes.org>
rain1 <rain1@airmail.cc>
tal@whatexit.org <tal@whatexit.org>
trantor <trantorvega@gmail.com>
zstadler <zeev.stadler@gmail.com>
+67 -1
View File
@@ -27,7 +27,7 @@ license, which can be found at:
https://creativecommons.org/licenses/by/3.0/
The documentation website includes a copy of Twitter's Boostrap and
The documentation website includes a copy of Twitter's Bootstrap and
relies on Bonsai, Liquid templates and various other projects, look
them up for detailed licensing conditions.
@@ -68,3 +68,69 @@ WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
jq uses parts of the open source C library "decNumber", which is distributed
under the following license:
ICU License - ICU 1.8.1 and later
COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1995-2005 International Business Machines Corporation and others
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
Portions Copyright (c) 2016 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
+2 -2
View File
@@ -372,7 +372,7 @@
Add BLOCK_8() macro
Fix `foreach` non-progation of errors
Fix `foreach` non-propagation of errors
Allow zero-length buffers in jv_parser_set_buf()
@@ -1183,7 +1183,7 @@
Fix various UTF8 parsing bugs.
In particular, parse bad UTF8 by replacing the broken bits with U+FFFD
and resychronise correctly after broken sequences.
and resynchronise correctly after broken sequences.
Fix example in manual for `floor`. See #155.
+31 -49
View File
@@ -1,53 +1,35 @@
FROM debian:8
FROM debian:12-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8
RUN apt-get update \
&& apt-get install -y \
build-essential \
autoconf \
libtool \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . /app
RUN autoreconf -i \
&& ./configure \
--disable-docs \
--disable-valgrind \
--with-oniguruma=builtin \
--enable-static \
--enable-all-static \
--prefix=/usr/local \
&& make -j$(nproc) \
&& make check VERBOSE=yes \
&& make install-strip
# get dependencies, build, and remove anything we don't need for running jq.
# valgrind seems to have trouble with pthreads TLS so it's off.
FROM scratch
RUN apt-get update && \
apt-get install -y \
build-essential \
autoconf \
libtool \
git \
bison \
flex \
ruby \
wget \
ruby-dev && \
wget https://github.com/kkos/oniguruma/archive/v5.9.6.tar.gz -O onig-5.9.6.tar.gz && \
sha512sum onig-5.9.6.tar.gz | grep 6b048d345e148c9da38af7a8df76d4a358eb3d4db91fa7834076e511f526a63544284f212b0d56badbbd33112c8b458a5fff02bfbbda012ecfe478bc436ea679 && \
tar zxvf onig-5.9.6.tar.gz && \
(cd oniguruma-5.9.6 && \
touch NEWS ChangeLog && \
autoreconf -i && \
./configure --prefix=/usr/local && \
make && \
make install ) && \
gem install bundler && \
(cd /app/docs && bundle install) && \
(cd /app && \
autoreconf -i && \
./configure --disable-valgrind --enable-all-static --prefix=/usr/local && \
make -j8 && \
make check && \
make install && \
make distclean ) && \
(cd oniguruma-5.9.6 && \
make uninstall ) && \
apt-get purge -y \
build-essential \
autoconf \
libtool \
bison \
git \
flex \
ruby \
ruby-dev && \
apt-get autoremove -y && \
rm -rf oniguruma-5.9.6 && \
rm -rf /var/lib/apt/lists/* /var/lib/gems
ENTRYPOINT ["/usr/local/bin/jq"]
CMD []
COPY --from=builder /app/AUTHORS /app/COPYING /usr/local/bin/jq /
RUN ["/jq", "--version"]
ENTRYPOINT ["/jq"]
+90 -59
View File
@@ -5,18 +5,21 @@ LIBJQ_INCS = src/builtin.h src/bytecode.h src/compile.h \
src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.h \
src/jv_unicode.h src/jv_utf8_tables.h src/lexer.l src/libm.h \
src/linker.h src/locfile.h src/opcode_list.h src/parser.y \
src/util.h
src/util.h src/decNumber/decContext.h src/decNumber/decNumber.h \
src/decNumber/decNumberLocal.h src/jv_dtoa_tsd.h src/jv_thread.h \
src/jv_private.h
LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
src/jq_test.c src/jv.c src/jv_alloc.c src/jv_aux.c \
src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c \
src/jv_unicode.c src/linker.c src/locfile.c src/util.c \
src/decNumber/decContext.c src/decNumber/decNumber.c \
src/jv_dtoa_tsd.c \
${LIBJQ_INCS}
### C build options
AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
-Wno-unused-parameter -Wno-unused-function
AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function
if WIN32
AM_CFLAGS += -municode
@@ -30,22 +33,22 @@ ACLOCAL_AMFLAGS = -I config/m4
# header file creation so we'll use good old make
if MAINTAINER_MODE
BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c \
src/builtin.inc src/version.h
src/builtin.inc src/config_opts.inc src/version.h
src/lexer.c: src/lexer.l
$(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $<
src/lexer.h: src/lexer.c
else
BUILT_SOURCES = src/builtin.inc src/version.h
BUILT_SOURCES = src/builtin.inc src/config_opts.inc src/version.h
.y.c:
$(AM_V_YACC) echo "NOT building parser.c!"
.l.c:
$(AM_V_LEX) echo "NOT building lexer.c!"
endif
# Tell YACC (bison) autoconf macros that you want a header file created.
# If the --warnings=all fails, you probably have an old version of bison
# OSX ships an old bison, so update with homebrew or macports
AM_YFLAGS = --warnings=all -d
# Tell YACC (Bison) autoconf macros that you want a header file created.
# If the --warnings=all fails, you probably have an old version of Bison
# macOS ships an old Bison, so update with Homebrew or MacPorts.
AM_YFLAGS = --warnings=all -Wno-yacc -d
### libjq
@@ -106,13 +109,21 @@ generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed
src/version.h: .remake-version-h
mkdir -p src
$(AM_V_GEN) $(generate_ver); echo "$$ver" > $@
src/main.c: src/version.h
src/builtin.inc: src/builtin.jq
src/config_opts.inc:
mkdir -p src
$(AM_V_GEN) sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' src/builtin.jq > $@
$(AM_V_GEN) if test -x ./config.status; then \
./config.status --config; \
else echo "(unknown)"; \
fi | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' -e 's/^/#define JQ_CONFIG /' > $@
src/main.c: src/version.h src/config_opts.inc
src/builtin.inc: $(srcdir)/src/builtin.jq
mkdir -p src
$(AM_V_GEN) sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $(srcdir)/src/builtin.jq > $@
src/builtin.o: src/builtin.inc
CLEANFILES = src/version.h .remake-version-h src/builtin.inc src/config_opts.inc
bin_PROGRAMS = jq
jq_SOURCES = src/main.c src/version.h
jq_LDFLAGS = -static-libtool-libs
@@ -128,23 +139,55 @@ endif
### Tests (make check)
TESTS = tests/optionaltest tests/mantest tests/jqtest tests/onigtest tests/shtest tests/utf8test tests/base64test
TESTS_ENVIRONMENT = NO_VALGRIND=$(NO_VALGRIND)
TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base64test
if !WIN32
TESTS += tests/optionaltest
endif
AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq NO_VALGRIND=$(NO_VALGRIND)
# This is a magic make variable that causes it to treat tests/man.test as a
# DATA-type dependency for the check target. As a result, it will attempt to
# run any defined targets for tests/man.test as a dependency for check. This
# allows us to ensure that the tests are up-to-date if the manual has been updated
check_DATA = tests/man.test
### Building the man tests
# We use the examples in the manual as additional tests, to ensure they always work.
# As a result, we need to rebuild the tests if the manual has been updated.
# Making changes to the manpage without having the python deps means your
# tests won't run. If you aren't making changes to the examples, you probably
# don't care. But if you are, then you need to run the tests anyway.
tests/man.test tests/manonig.test: $(srcdir)/docs/content/manual/manual.yml
if ENABLE_DOCS
$(AM_V_GEN) ( cd ${abs_srcdir}/docs && \
$(PIPENV) run python validate_manual_schema.py content/manual/manual.yml && \
$(PIPENV) run python build_mantests.py )
else
@echo Changes to the manual.yml require docs to be enabled to update the manual test.
@echo As a result, the manual test is out of date.
endif
### Building the manpage
# We build the docs from the manpage yml. If no changes have been made to the
# manpage, then we'll end up using the cached version. Otherwise, we need to
# rebuild it.
man_MANS = jq.1
jq.1.prebuilt: $(srcdir)/docs/content/manual/manual.yml
if ENABLE_DOCS
jq.1: $(srcdir)/docs/content/3.manual/manual.yml
$(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $@ || { rm -f $@; false; }
jq.1.prebuilt: jq.1
$(AM_V_GEN) cp jq.1 $@ || { rm -f $@; false; }
$(AM_V_GEN) ( cd ${abs_srcdir}/docs && \
$(PIPENV) run python validate_manual_schema.py content/manual/manual.yml && \
$(PIPENV) run python build_manpage.py ) > $@
else
jq.1: $(srcdir)/jq.1.prebuilt
$(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@
@echo Changes to the manual.yml require docs to be enabled to update the manpage.
@echo As a result, the manpage is out of date.
endif
jq.1: jq.1.prebuilt
$(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@
CLEANFILES += jq.1
### Build oniguruma
@@ -155,43 +198,50 @@ endif
AM_CFLAGS += $(onig_CFLAGS)
### Packaging
if WITH_ONIGURUMA
TESTS += tests/onigtest tests/manonigtest
endif
docs/site.yml: configure.ac
sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new
mv $@.new $@
### Packaging
install-binaries: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-exec
DOC_FILES = docs/content docs/public docs/templates docs/site.yml \
docs/Gemfile docs/Gemfile.lock docs/Rakefile docs/README.md \
jq.1.prebuilt
DOC_FILES = docs/content docs/public docs/templates \
docs/Pipfile docs/Pipfile.lock docs/build_manpage.py \
docs/build_mantests.py docs/build_website.py docs/README.md \
docs/validate_manual_schema.py docs/manual_schema.yml
EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \
jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \
src/parser.h src/version.h src/builtin.jq \
scripts/version tests/jq.test tests/modules/.jq \
src/parser.h src/version.h src/builtin.jq scripts/version \
libjq.pc \
tests/base64.test tests/jq-f-test.sh tests/jq.test \
tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \
tests/modules/c/d.jq tests/modules/data.json \
tests/modules/home1/.jq tests/modules/home2/.jq/g.jq \
tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \
tests/modules/shadow1.jq tests/modules/shadow2.jq \
tests/modules/syntaxerror/syntaxerror.jq \
tests/modules/test_bind_order.jq \
tests/modules/test_bind_order0.jq \
tests/modules/test_bind_order1.jq \
tests/modules/test_bind_order2.jq tests/onig.supp \
tests/onig.test tests/setup tests/torture/input0.json \
tests/optional.test tests/optionaltest \
tests/utf8-truncate.jq tests/utf8test \
tests/base64.test tests/base64test \
tests/jq-f-test.sh tests/shtest
tests/modules/test_bind_order2.jq \
tests/onig.supp tests/local.supp \
tests/setup tests/torture/input0.json \
tests/optional.test tests/man.test tests/manonig.test \
tests/jq.test tests/onig.test tests/base64.test \
tests/utf8-truncate.jq tests/jq-f-test.sh \
tests/no-main-program.jq tests/yes-main-program.jq
AM_DISTCHECK_CONFIGURE_FLAGS=--with-oniguruma=builtin
# README.md is expected in Github projects, good stuff in it, so we'll
# README.md is expected in GitHub projects, good stuff in it, so we'll
# distribute it and install it with the package in the doc directory.
docdir = ${datadir}/doc/${PACKAGE}
dist_doc_DATA = README.md COPYING AUTHORS README
dist_doc_DATA = README.md NEWS.md COPYING AUTHORS
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libjq.pc
RELEASE ?= 1
rpm: dist jq.spec
@@ -201,22 +251,3 @@ rpm: dist jq.spec
rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $(VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$(VERSION).tar.gz
find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;
rm -rf rpm
dist-clean-local:
rm -f ${BUILT_SOURCES}
# Not sure why this doesn't get cleaned up automatically, guess
# automake used to man pages which are hand coded?
# 'make clean' doesn't delete the manpage if it can't be rebuilt
clean-local-docs:
if ENABLE_DOCS
rm -f jq.1
endif
clean-local-gcov:
rm -f src/*.gcno src/*.gcda src/*.gcov
clean-local: clean-local-docs clean-local-gcov
rm -f src/version.h .remake-version-h
.PHONY: clean-local-docs clean-local-gcov
-113
View File
@@ -1,113 +0,0 @@
Release history
* jq version 1.6 was released on Fri Nov 2 2018
* jq version 1.5 was released on Sat Aug 15 2015
* jq version 1.4 was released on Mon Jun 9 2014
* jq version 1.3 was released on Sun May 19 2013
* jq version 1.2 was released on Thu Dec 20 2012
* jq version 1.1 was released on Sun Oct 21 2012
* jq version 1.0 was released on Sun Oct 21 2012
New features in 1.6 since 1.5:
- Destructuring Alternation
- New Builtins:
- builtins/0
- stderr/0
- halt/0, halt_error/1
- isempty/1
- walk/1
- utf8bytelength/1
- localtime/0, strflocaltime/1
- SQL-style builtins
- and more!
- Add support for ASAN and UBSAN
- Make it easier to use jq with shebangs (8f6f28c)
- Add $ENV builtin variable to access environment
- Add JQ_COLORS env var for configuring the output colors
New features in 1.5 since 1.4:
- regular expressions (with Oniguruma)
- a library/module system
- many new builtins
- datetime builtins
- math builtins
- regexp-related builtins
- stream-related builtins (e.g., all/1, any/1)
- minimal I/O builtins (`inputs`, `debug`)
- new syntactic features, including:
- destructuring (`. as [$first, $second] | ...`)
- try/catch, generalized `?` operator, and label/break
- `foreach`
- multiple definitions of a function with different numbers of
arguments
- command-line arguments
- --join-lines / -j for raw output
- --argjson and --slurpfile
- --tab and --indent
- --stream (streaming JSON parser)
- --seq (RFC7464 JSON text sequence)
- --run-tests improvements
- optimizations:
- tail-call optimization
- reduce and foreach no longer leak a reference to .
New features in 1.4 since 1.3:
- command-line arguments
- jq --arg-file variable file
- jq --unbuffered
- jq -e / --exit-status (set exit status based on outputs)
- jq -S / --sort-keys (now jq no longer sorts object keys by
default
- syntax
- .. -> like // in XPath (recursive traversal)
- question mark (e.g., .a?) to suppress errors
- ."foo" syntax (equivalent to .["foo"])
- better error handling for .foo
- added % operator (modulo)
- allow negation without requiring extra parenthesis
- more function arguments (up to six)
- filters:
- any, all
- iterables, arrays, objects, scalars, nulls, booleans, numbers,
strings, values
- string built-ins:
- split
- join (join an array of strings with a given separator string)
- ltrimstr, rtrimstr
- startswith, endswith
- explode, implode
- fromjson, tojson
- index, rindex, indices
- math functions
- floor, sqrt, cbrt, etetera (depends on what's available from libm)
- libjq -- a C API interface to jq's JSON representation and for
running jq programs from C applications
+343
View File
@@ -0,0 +1,343 @@
# 1.7
After a five year hiatus we're back with a GitHub organization, with new admins and new maintainers who have brought a great deal of energy to make a long-awaited and long-needed new release. We're very grateful for all the new owners, admins, and maintainers. Special thanks go to Owen Ou (@owenthereal) for pushing to set up a new GitHub organization for jq, Stephen Dolan (@stedolan) for transferring the jq repository to the new organization, @itchyny for doing a great deal of work to get the release done, Mattias Wadman (@wader) and Emanuele Torre (@emanuele6) for many PRs and code reviews. Many others also contributed PRs, issues, and code reviews as well, and you can find their contributions in the Git log and on the [closed issues and PRs page](https://github.com/jqlang/jq/issues?q=is%3Aclosed+sort%3Aupdated-desc).
Since the last stable release many things have happened:
- jq now lives at <https://github.com/jqlang>
- New maintainers, admins, and owners have been recruited.
- A list of [current maintainers](https://github.com/jqlang/jq/blob/jq-1.7/AUTHORS#L4-L14)
- NEWS file is replaced by NEWS.md with Markdown format. @wader #2599
- CI, scan builds, release, website builds etc now use GitHub actions. @owenthereal @wader @itchyny #2596 #2603 #2620 #2723
- Lots of documentation improvements and fixes.
- Website updated with new section search box, better section ids for linking, dark mode, etc. @itchyny #2628
- Release builds for:
- Linux `amd64`, `arm64`, `armel`, `armhf`, `i386`, `mips`, `mips64`, `mips64el`, `mips64r6`, `mips64r6el`, `mipsel`, `mipsr6`, `mipsr6el`, `powerpc`, `ppc64el`, `riscv64` and `s390x`
- macOS `amd64` and `arm64`
- Windows `i386` and `amd64`
- Docker `linux/386`, `linux/amd64`, `linux/arm64`, `linux/mips64le`, `linux/ppc64le`, `linux/riscv64` and `linux/s390x`
- More details see @owenthereal #2665
- Docker images are now available from `ghcr.io/jqlang/jq` instead of Docker Hub. @itchyny #2652 #2686
- OSS-fuzz. @DavidKorczynski #2760 #2762
Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.6...jq-1.7> but here are some highlights:
## CLI changes
- Make object key color configurable using `JQ_COLORS` environment variable. @itchyny @haguenau @ericpruitt #2703
```sh
# this would make "field" bold yellow (`1;33`, the last value)
$ JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}'
{
"field": 123
}
```
- Change the default color of null to Bright Black. @itchyny #2824
- Respect `NO_COLOR` environment variable to disable color output. See <https://no-color.org> for details. @itchyny #2728
- Improved `--help` output. Now mentions all options and nicer order. @itchyny @wader #2747 #2766 #2799
- Fix multiple issues of exit code using `--exit-code`/`-e` option. @ryo1kato #1697
```sh
# true-ish last output value exits with zero
$ jq -ne true ; echo $?
true
0
# false-ish last output value (false and null) exits with 1
$ jq -ne false ; echo $?
false
1
# no output value exists with 4
$ jq -ne empty ; echo $?
4
```
- Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. @nicowilliams 0dab2b1
- Add `--raw-output0` for NUL (zero byte) separated output. @asottile @pabs3 @itchyny #1990 #2235 #2684
```sh
# will output a zero byte after each output
$ jq -n --raw-output0 '1,2,3' | xxd
00000000: 3100 3200 3300 1.2.3.
# can be used with xargs -0
$ jq -n --raw-output0 '"a","b","c"' | xargs -0 -n1
a
b
c
$ jq -n --raw-output0 '"a b c", "d\ne\nf"' | xargs -0 printf '[%s]\n'
[a b c]
[d
e
f]
# can be used with read -d ''
$ while IFS= read -r -d '' json; do
> jq '.name' <<< "$json"
> done < <(jq -n --raw-output0 '{name:"a b c"},{name:"d\ne\nf"}')
"a b c"
"d\ne\nf"
# also it's an error to output a string containing a NUL when using NUL separator
$ jq -n --raw-output0 '"\u0000"'
jq: error (at <unknown>): Cannot dump a string containing NUL with --raw-output0 option
```
- Fix assert crash and validate JSON for `--jsonarg`. @wader #2658
- Remove deprecated `--argfile` option. @itchyny #2768
- Enable stack protection. @nicowilliams #2801
## Language changes
- Use decimal number literals to preserve precision. Comparison operations respects precision but arithmetic operations might truncate. @leonid-s-usov #1752
```sh
# precision is preserved
$ echo '100000000000000000' | jq .
100000000000000000
# comparison respects precision (this is false in JavaScript)
$ jq -n '100000000000000000 < 100000000000000001'
true
# sort/0 works
$ jq -n -c '[100000000000000001, 100000000000000003, 100000000000000004, 100000000000000002] | sort'
[100000000000000001,100000000000000002,100000000000000003,100000000000000004]
# arithmetic operations might truncate (same as JavaScript)
$ jq -n '100000000000000000 + 10'
100000000000000020
```
- Adds new builtin `pick(stream)` to emit a projection of the input object or array. @pkoppstein #2656 #2779
```sh
$ jq -n '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4} | pick(.a, .b.c, .x)'
{
"a": 1,
"b": {
"c": 2
},
"x": null
}
```
- Adds new builtin `debug(msgs)` that works like `debug` but applies a filter on the input before writing to stderr. @pkoppstein #2710
```sh
$ jq -n '1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1)'
["DEBUG:","Entering function foo with $x == 1"]
["DEBUG:",2]
3
$ jq -n '{a: 1, b: 2, c: 3} | debug({a, b, sum: (.a+.b)})'
["DEBUG:",{"a":1,"b":2,"sum":3}]
{
"a": 1,
"b": 2,
"c": 3
}
```
- Adds new builtin `scan($re; $flags)`. Was documented but not implemented. @itchyny #1961
```sh
# look for pattern "ab" in "abAB" ignoring casing
$ jq -n '"abAB" | scan("ab"; "i")'
"ab"
"AB"
```
- Adds new builtin `abs` to get absolute value. This potentially allows the literal value of numbers to be preserved as `length` and `fabs` convert to float. @pkoppstein #2767
- Allow `if` without `else`-branch. When skipped the `else`-branch will be `.` (identity). @chancez @wader #1825 #2481
```sh
# convert 1 to "one" otherwise keep as is
$ jq -n '1,2 | if . == 1 then "one" end'
"one"
2
# behaves the same as
$ jq -n '1,2 | if . == 1 then "one" else . end'
"one"
2
# also works with elif
$ jq -n '1,2,3 | if . == 1 then "one" elif . == 2 then "two" end
"one"
"two"
3
```
- Allow use of `$binding` as key in object literals. @nicowilliams 8ea4a55
```sh
$ jq -n '"a" as $key | {$key: 123}'
{
"a": 123
}
# previously parentheses were needed
$ jq -n '"a" as $key | {($key): 123}'
{
"a": 123
}
```
- Allow dot between chained indexes when using `.["index"]` @nicowilliams #1168
```sh
$ jq -n '{"a": {"b": 123}} | .a["b"]'
123
# now this also works
$ jq -n '{"a": {"b": 123}} | .a.["b"]'
123
```
- Allow dot for chained value iterator `.[]`, `.[]?` @wader #2650
```sh
$ jq -n '{"a": [123]} | .a[]'
123
# now this also works
$ jq -n '{"a": [123]} | .a.[]'
123
```
- Fix try/catch catches more than it should. @nicowilliams #2750
- Speed up and refactor some builtins, also remove `scalars_or_empty/0`. @muhmuhten #1845
- Now `halt` and `halt_error` exit immediately instead of continuing to the next input. @emanuele6 #2667
- Fix issue converting string to number after previous convert error. @thalman #2400
- Fix issue representing large numbers on some platforms causing invalid JSON output. @itchyny #2661
- Fix deletion using assigning empty against arrays. @itchyny #2133
```sh
# now this works as expected, filter out all values over 2 by assigning empty
$ jq -c '(.[] | select(. >= 2)) |= empty' <<< '[1,5,3,0,7]'
[1,0]
```
- Allow keywords to be used as binding name in more places. @emanuele6 #2681
- Allow using `nan` as NaN in JSON. @emanuele6 #2712
- Expose a module's function names in `modulemeta`. @mrwilson #2837
- Fix `contains/1` to handle strings with NUL. @nicowilliams 61cd6db
- Fix `stderr/0` to output raw text without any decoration. @itchyny #2751
- Fix `nth/2` to emit empty on index out of range. @itchyny #2674
- Fix `implode` to not assert and instead replace invalid unicode codepoints. @wader #2646
- Fix `indices/1` and `rindex/1` in case of overlapping matches in strings. @emanuele6 #2718
- Fix `sub/3` to resolve issues involving global search-and-replace (gsub) operations. @pkoppstein #2641
- Fix `significand/0`, `gamma/0` and `drem/2` to be available on macOS. @itchyny #2756 #2775
- Fix empty regular expression matches. @itchyny #2677
- Fix overflow exception of the modulo operator. @itchyny #2629
- Fix string multiplication by 0 (and less than 1) to emit empty string. @itchyny #2142
- Fix segfault when using libjq and threads. @thalman #2546
- Fix constant folding of division and reminder with zero divisor. @itchyny #2797
- Fix `error/0`, `error/1` to throw null error. @emanuele6 #2823
- Simpler and faster `transpose`. @pkoppstein #2758
- Simple and efficient implementation of `walk/1`. @pkoppstein #2795
- Remove deprecated filters `leaf_paths`, `recurse_down`. @itchyny #2666
# Previous releases
Release history
- jq version 1.6 was released on Fri Nov 2 2018
- jq version 1.5 was released on Sat Aug 15 2015
- jq version 1.4 was released on Mon Jun 9 2014
- jq version 1.3 was released on Sun May 19 2013
- jq version 1.2 was released on Thu Dec 20 2012
- jq version 1.1 was released on Sun Oct 21 2012
- jq version 1.0 was released on Sun Oct 21 2012
New features in 1.6 since 1.5:
- Destructuring Alternation
- New Builtins:
- builtins/0
- stderr/0
- halt/0, halt_error/1
- isempty/1
- walk/1
- utf8bytelength/1
- localtime/0, strflocaltime/1
- SQL-style builtins
- and more!
- Add support for ASAN and UBSAN
- Make it easier to use jq with shebangs (8f6f28c)
- Add $ENV builtin variable to access environment
- Add JQ_COLORS env var for configuring the output colors
New features in 1.5 since 1.4:
- regular expressions (with Oniguruma)
- a library/module system
- many new builtins
- datetime builtins
- math builtins
- regexp-related builtins
- stream-related builtins (e.g., all/1, any/1)
- minimal I/O builtins (`inputs`, `debug`)
- new syntactic features, including:
- destructuring (`. as [$first, $second] | ...`)
- try/catch, generalized `?` operator, and label/break
- `foreach`
- multiple definitions of a function with different numbers of
arguments
- command-line arguments
- --join-lines / -j for raw output
- --argjson and --slurpfile
- --tab and --indent
- --stream (streaming JSON parser)
- --seq (RFC7464 JSON text sequence)
- --run-tests improvements
- optimizations:
- tail-call optimization
- reduce and foreach no longer leak a reference to .
New features in 1.4 since 1.3:
- command-line arguments
- jq --arg-file variable file
- jq --unbuffered
- jq -e / --exit-status (set exit status based on outputs)
- jq -S / --sort-keys (now jq no longer sorts object keys by
default
- syntax
- .. -> like // in XPath (recursive traversal)
- question mark (e.g., .a?) to suppress errors
- ."foo" syntax (equivalent to .["foo"])
- better error handling for .foo
- added % operator (modulo)
- allow negation without requiring extra parenthesis
- more function arguments (up to six)
- filters:
- any, all
- iterables, arrays, objects, scalars, nulls, booleans, numbers,
strings, values
- string built-ins:
- split
- join (join an array of strings with a given separator string)
- ltrimstr, rtrimstr
- startswith, endswith
- explode, implode
- fromjson, tojson
- index, rindex, indices
- math functions
- floor, sqrt, cbrt, etcetera (depends on what's available from libm)
- libjq -- a C API interface to jq's JSON representation and for
running jq programs from C applications
-1
View File
@@ -1 +0,0 @@
README.md
+39 -52
View File
@@ -1,73 +1,60 @@
jq
==
# jq
jq is a lightweight and flexible command-line JSON processor.
`jq` is a lightweight and flexible command-line JSON processor akin to`sed`,`awk`,`grep`, and friends for JSON data. It's written in portable C and has zero runtime dependencies, allowing you to easily slice, filter, map, and transform structured data.
[![Coverage Status](https://coveralls.io/repos/stedolan/jq/badge.svg?branch=master&service=github)](https://coveralls.io/github/stedolan/jq?branch=master),
Unix: [![Build Status](https://travis-ci.org/stedolan/jq.svg?branch=master)](https://travis-ci.org/stedolan/jq),
Windows: [![Windows build status](https://ci.appveyor.com/api/projects/status/mi816811c9e9mx29?svg=true)](https://ci.appveyor.com/project/stedolan/jq)
## Documentation
- **Official Documentation**: [jqlang.github.io/jq](https://jqlang.github.io/jq)
- **Try jq Online**: [jqplay.org](https://jqplay.org)
If you want to learn to use jq, read the documentation at
[https://stedolan.github.io/jq](https://stedolan.github.io/jq). This
documentation is generated from the docs/ folder of this repository.
You can also try it online at [jqplay.org](https://jqplay.org).
## Installation
If you want to hack on jq, feel free, but be warned that its internals
are not well-documented at the moment. Bring a hard hat and a
shovel. Also, read the wiki: https://github.com/stedolan/jq/wiki, where
you will find cookbooks, discussion of advanced topics, internals,
release engineering, and more.
### Prebuilt Binaries
Source tarball and built executable releases can be found on the
homepage and on the github release page, https://github.com/stedolan/jq/releases
Download the latest releases from the [GitHub release page](https://github.com/jqlang/jq/releases).
If you're building directly from the latest git, you'll need flex,
bison (3.0 or newer), libtool, make, automake, and autoconf installed.
To get regexp support you'll also need to install Oniguruma or clone it as a
git submodule as per the instructions below.
(note that jq's tests require regexp support to pass). To build, run:
### Docker Image
git submodule update --init # if building from git to get oniguruma
autoreconf -fi # if building from git
./configure --with-oniguruma=builtin
make -j8
make check
Pull the [jq image](https://github.com/jqlang/jq/pkgs/container/jq) to start quickly with Docker.
To build without bison or flex, add `--disable-maintainer-mode` to the
./configure invocation:
### Building from source
./configure --with-oniguruma=builtin --disable-maintainer-mode
#### Dependencies
(Developers must not use `--disable-maintainer-mode`, not when making
changes to the jq parser and/or lexer.)
- libtool
- make
- automake
- autoconf
To build a statically linked version of jq, run:
#### Instructions
make LDFLAGS=-all-static
```console
git submodule update --init # if building from git to get oniguruma
autoreconf -i # if building from git
./configure --with-oniguruma=builtin
make -j8
make check
sudo make install
```
After make finishes, you'll be able to use `./jq`. You can also
install it using:
Build a statically linked version:
sudo make install
```console
make LDFLAGS=-all-static
```
If you're not using the latest git version but instead building a
released tarball (available on the website), then you won't need to
run `autoreconf` (and shouldn't), and you won't need flex or bison.
If you're not using the latest git version but instead building a released tarball (available on the release page), skip the `autoreconf` step, and flex or bison won't be needed.
To cross-compile for OS X and Windows, see docs/Rakefile's build task
and scripts/crosscompile. You'll need a cross-compilation environment,
such as Mingw for cross-compiling for Windows.
##### Cross-Compilation
Cross-compilation requires a clean workspace, then:
For details on cross-compliation, check out the [GitHub Actions file](.github/workflows/ci.yml) and the [cross-compliation wiki page](https://github.com/jqlang/jq/wiki/Cross-compilation).
# git clean ...
autoreconf -i
./configure
make distclean
scripts/crosscompile <name-of-build> <configure-options>
## Community & Support
Use the --host= and --target= ./configure options to select a
cross-compilation environment. See also the wiki.
- Questions & Help: [Stack Overflow (jq tag)](https://stackoverflow.com/questions/tagged/jq)
- Chat & Community: [Join us on Discord](https://discord.gg/yg6yjNmgAC)
- Wiki & Advanced Topics: [Explore the Wiki](https://github.com/jqlang/jq/wiki)
Send questions to https://stackoverflow.com/questions/tagged/jq or to the #jq channel (http://irc.lc/freenode/%23jq/) on Freenode (https://webchat.freenode.net/).
## License
`jq` is released under the [MIT License](COPYING).
+7
View File
@@ -0,0 +1,7 @@
# How to report security vulnerabilities in `jq`
GitHub has a [mechanism for private disclosure of vulnerabilities](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability) to repository owners and authorized persons such as maintainers. The `jqlang/jq` repository now has this feature enabled.
## Reporting a Vulnerability
See [Privately Reporting a Security Vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability). Click on [`jqlang/jq`](https://github.com/jqlang/jq)'s [Security page](https://github.com/jqlang/jq/security) and click on [Report a vulnerability](https://github.com/jqlang/jq/security/advisories/new). This will notify the owners and maintainers. After submitting you'll get an option to start a private clone of `jqlang/jq` for collaboration with the maintainers.
-53
View File
@@ -1,53 +0,0 @@
environment:
matrix:
- MSYSTEM: MINGW64
PATH: C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\Windows\System32;C:\Windows;%PATH%
- MSYSTEM: MINGW32
PATH: C:\msys64\usr\bin;C:\msys64\mingw32\bin;C:\Windows\System32;C:\Windows;%PATH%
clone_script:
- bash -lc "git clone -q --branch=$APPVEYOR_REPO_BRANCH https://github.com/${APPVEYOR_REPO_NAME}.git $APPVEYOR_BUILD_FOLDER"
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && git checkout -qf $APPVEYOR_REPO_BRANCH"
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && git submodule update --init --recursive"
install:
# update mysy2
- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S autoconf automake bison flex"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S git"
build_script:
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && autoreconf -i"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && ./configure --with-oniguruma=builtin --disable-shared --enable-static --enable-all-static"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make -j8"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && cat jq.1 | groff -mandoc -Thtml > jq.html"
- 7z a jq-package.zip jq.1 jq.html jq.exe
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && pwd && ls -la"
- file jq.exe
test_script:
# tests/optionaltest and tests/shtest fail on Windows; run them
# anyways but ignore their failures. Also, trace shtest.
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make -j3 SUBDIRS= 'TESTS=tests/mantest tests/jqtest tests/onigtest tests/base64test' check"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make SUBDIRS= TESTS=tests/optionaltest check || true"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make SUBDIRS= TRACE_TESTS=1 TESTS=tests/shtest check || true"
artifacts:
- path: jq-package.zip
name: jq-package
- path: jq.exe
name: jq-exe
- path: test-suite.log
name: logs
on_failure:
- cat config.log
- cat test-suite.log
- appveyor PushArtifact test-suite.log
# also push the jq.exe so that someone can download it anyways...
- appveyor PushArtifact jq-package.zip
+85 -81
View File
@@ -1,102 +1,106 @@
#!/bin/bash
#!/usr/bin/env bash
# Mac C. compile-ios.sh for JQ.
# old values
OLD_CFLAGS=$CFLAGS
OLD_LDFLAGS=$LDFLAGS
ORIG_PWD=`pwd`
# Defaults
set -e
oniguruma='6.9.3'
# For parallelism in make
NJOBS="-j`sysctl -n hw.ncpu || echo 1`"
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
# Parse args.
usage(){
cat << EOF
${0##*/}: usage
# Get oniguruma
rm -rf $PWD/build/ios oniguruma-5.9.6
echo "Downloading oniguruma 5.9.6"
curl -L https://github.com/kkos/oniguruma/archive/v5.9.6.tar.gz | tar xz
cd oniguruma-5.9.6
Description:
This simple script builds oniguruma and jq for all *-apple-darwin devices.
# So, we need to remake the configure scripts so that the arm64 architecture
# exists in config.sub. In order to keep autoreconf from failing, create
# NEWS and ChangeLog.
touch NEWS ChangeLog
autoreconf -fi >/dev/null 2>&1
Arguments:
--extra-cflags <arg>: Pass defines or includes to clang.
--extra-ldflags <arg>: Pass libs or includes to ld64.
--with-oniguruma <arg>: Change default version of onigurma from ${oniguruma}.
EOF
exit 1
}
while (( $# )); do
case "$1" in
--with-oniguruma) shift; oniguruma="${1}" ;;
--extra-cflags) shift; export CFLAGS_="${1}" ;;
--extra-ldflags) shift; export LDFLAGS_="${1}" ;;
CC=`xcrun -f clang`
cd $ORIG_PWD
--help) usage ;;
*) echo -e "Unknown option: ${1}\n"; usage ;;
esac
shift
done
autoreconf -fi
for arch in i386 x86_64 armv7 armv7s arm64; do
# Start building.
echo "Building..."
MAKEJOBS="$(sysctl -n hw.ncpu || echo 1)"
CC_="$(xcrun -f clang || echo clang)"
# Some of the architectures are a bit different...
if [[ "$arch" = "i386" || "$arch" = "x86_64" ]]
then
SYSROOT=`xcrun -f --sdk iphonesimulator --show-sdk-path`
else
SYSROOT=`xcrun -f --sdk iphoneos --show-sdk-path`
fi
if [[ "$arch" = "arm64" ]]
then
HOST="aarch64-apple-darwin"
else
HOST="$arch-apple-darwin"
fi
onig_url="https://github.com/kkos/oniguruma/releases/download/v${oniguruma}/onig-${oniguruma}.tar.gz"
builddir="${TMPDIR:-/tmp}/${RANDOM:-'xxxxx'}-compile-ios-build"
cwd="$(realpath ${PWD} 2>/dev/null || echo ${PWD})"
CFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_CFLAGS"
LDFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_LDFLAGS"
t_exit() {
cat << EOF
A error as occurred.
oniguruma location: ${builddir}/onig/onig-${oniguruma}
jq location: ${cwd}
Provide config.log and console logs when posting a issue.
# Build oniguruma for this architecture
cd oniguruma-5.9.6
CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --disable-shared --enable-static --host=$HOST --prefix=$ORIG_PWD/build/ios/$arch
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Failed to configure oniguruma for architecture $arch. Check `pwd`/config.log for details."
cd $PWD
exit $STATUS
fi
make clean
make $NJBOS install
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Failed to make oniguruma for architecture $arch."
cd $PWD
exit $STATUS
fi
EOF
}
trap t_exit ERR
# Onig.
mkdir -p "${builddir}/onig"
cd "${builddir}/"
curl -L ${onig_url} | tar xz
for arch in i386 x86_64 armv7 armv7s arm64; do
if [[ "$arch" = "i386" || "$arch" = "x86_64" ]]; then
SYSROOT=$(xcrun -f --sdk iphonesimulator --show-sdk-path)
else
SYSROOT=$(xcrun -f --sdk iphoneos --show-sdk-path)
fi
HOST="${arch}-apple-darwin"
[[ "${arch}" = "arm64" ]] && HOST="aarch64-apple-darwin"
CFLAGS="-arch ${arch} -miphoneos-version-min=9.0 -isysroot ${SYSROOT} ${CFLAGS_} -D_REENTRANT"
LDFLAGS="-arch ${arch} -miphoneos-version-min=9.0 -isysroot ${SYSROOT} ${LDFLAGS_}"
CC="${CC_} ${CFLAGS}"
# Build jq for this architecture
cd $ORIG_PWD
CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --disable-shared --enable-static -host=$HOST --prefix=$ORIG_PWD/build/ios/$arch --with-oniguruma=$ORIG_PWD/build/ios/$arch
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Failed to configure jq for architecture $arch"
exit $STATUS
fi
make clean
make $NJOBS install
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Failed to make jq for architecture $arch"
exit $STATUS
fi
done
# ./configure; make install
cd "${builddir}/onig-${oniguruma}"
CC=${CC} LDFLAGS=${LDFLAGS} \
./configure --host=${HOST} --build=$(./config.guess) --enable-shared=no --enable-static=yes --prefix=/
make -j${MAKEJOBS} install DESTDIR="${cwd}/ios/onig/${arch}"
make clean
# Jump back to JQ.
cd ${cwd}
[[ ! -f ./configure ]] && autoreconf -ivf
CC=${CC} LDFLAGS=${LDFLAGS} \
./configure --host=${HOST} --build=$(./config/config.guess) --enable-docs=no --enable-shared=no --enable-static=yes --prefix=/ --with-oniguruma=${cwd}/ios/onig/${arch} $(test -z ${BISON+x} || echo '--enable-maintainer-mode')
make -j${MAKEJOBS} install DESTDIR="${cwd}/ios/jq/${arch}"
make clean
done
mkdir -p "${cwd}/ios/dest/lib"
# lipo, make a static lib.
lipo -create -output ${cwd}/ios/dest/lib/libonig.a ${cwd}/ios/onig/{i386,x86_64,armv7,armv7s,arm64}/lib/libonig.a
lipo -create -output ${cwd}/ios/dest/lib/libjq.a ${cwd}/ios/jq/{i386,x86_64,armv7,armv7s,arm64}/lib/libjq.a
# lipo together the different architectures into a universal 'fat' file
lipo -create -output $ORIG_PWD/build/ios/libonig.a $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}/lib/libonig.a
lipo -create -output $ORIG_PWD/build/ios/libjq.a $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}/lib/libjq.a
# Take the arm64 headers- the most common target.
cp -r ${cwd}/ios/jq/arm64/include ${cwd}/ios/dest/
rm -rf ${cwd}/build/ios/{i386,x86_64,armv7,armv7s,arm64}
# copy the products into the destination directory and clean up the single-architecture files.
cp $ORIG_PWD/build/ios/i386/include/*.h $ORIG_PWD/build/ios/
rm -rf $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}
echo "Products are in $ORIG_PWD/build/ios"
echo "Output to ${cwd}/ios/dest"
+69 -55
View File
@@ -1,23 +1,17 @@
m4_define([jq_version],
m4_esyscmd_s([(git rev-parse --verify -q jq-1.0 > /dev/null &&
(git describe --tags --dirty --match 'jq-*'|sed 's/^jq-//')) ||
echo `git rev-parse --abbrev-ref HEAD`-`git describe --always --dirty`])))
m4_define([jq_version], m4_esyscmd_s([scripts/version])))
AC_INIT([jq], [jq_version], [https://github.com/stedolan/jq/issues],
[jq], [https://stedolan.github.io/jq])
m4_include([m4/ax_compare_version.m4])
m4_include([m4/ax_prog_bison_version.m4])
AC_INIT([jq],[jq_version],[https://github.com/jqlang/jq/issues],[jq],[https://jqlang.github.io/jq])
dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
AC_PREREQ([2.64])
AC_PREREQ([2.65])
AC_CONFIG_AUX_DIR([config])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([1.11.2 subdir-objects parallel-tests foreign -Wall])
AM_SILENT_RULES([yes])
AM_PROG_AR
AM_MAINTAINER_MODE([enable])
AM_MAINTAINER_MODE([disable])
AC_PROG_CC
AC_PROG_CC_STDC
m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
AC_PROG_CPP_WERROR
AC_PROG_YACC
AC_OBJEXT
@@ -25,6 +19,7 @@ AC_EXEEXT
LT_INIT([shared static win32-dll])
AM_PROG_CC_C_O
AC_SYS_LARGEFILE # issue 2167
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
dnl AC_PROG_YACC macros...
@@ -38,7 +33,7 @@ if test "$USE_MAINTAINER_MODE" = yes; then
else
AX_PROG_BISON_VERSION([3],
[],
[AC_MSG_ERROR([You need bison version 3.0 or greater, or use --disable-maintainer-mode.])])
[AC_MSG_ERROR([You need bison version 3.0 or greater])])
fi
AC_CHECK_PROGS(LEX, flex lex)
@@ -52,62 +47,72 @@ fi
AC_CHECK_FUNCS(memmem)
AC_CHECK_FUNCS(mkstemp)
AC_CHECK_HEADER("shlwapi.h",[have_win32=1;])
AM_CONDITIONAL([WIN32], [test "x$have_win32" = x1])
AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])
AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])
AM_CONDITIONAL([WIN32], [test \( "x$have_shlwapi" = x1 \) -a ! \( "x$have_cygwin" = x1 \)])
dnl Running tests with Valgrind is slow. It is faster to iterate on
dnl code without Valgrind until tests pass, then enable Valgrind and
dnl fix leaks.
AC_ARG_ENABLE([valgrind],
AC_HELP_STRING([--disable-valgrind], [do not run tests under Valgrind]))
AS_HELP_STRING([--disable-valgrind],[do not run tests under Valgrind]))
dnl Running tests with Valgrind is slow; address sanitizer (ASAN) is
dnl faster.
AC_ARG_ENABLE([asan],
AC_HELP_STRING([--enable-asan], [enable address sanitizer]))
AS_HELP_STRING([--enable-asan],[enable address sanitizer]))
dnl Undefined Behavior Sanitizer
AC_ARG_ENABLE([ubsan],
AC_HELP_STRING([--enable-ubsan], [enable undefined behavior sanitizer]))
AS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer]))
dnl Code coverage
AC_ARG_ENABLE([gcov],
AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool]))
AS_HELP_STRING([--enable-gcov],[enable gcov code coverage tool]))
dnl Don't attempt to build docs if there's no Ruby lying around
dnl Don't attempt to build docs if python deps aren't installed
AC_ARG_ENABLE([docs],
AC_HELP_STRING([--disable-docs], [don't build docs]))
AS_HELP_STRING([--disable-docs],[do not build docs]), [], [enable_docs=yes])
dnl Don't attempt to build the error injection object (if there is no LD_PRELOAD support)
AC_ARG_ENABLE([error-injection],
AC_HELP_STRING([--enable-error-injection], [build and test with error injection]))
AS_HELP_STRING([--enable-error-injection],[build and test with error injection]))
dnl Enable building all static
AC_ARG_ENABLE([all-static],
AC_HELP_STRING([--enable-all-static], [link jq with static libraries only]))
AS_HELP_STRING([--enable-all-static],[link jq with static libraries only]))
dnl find pipenv
AC_ARG_VAR([PIPENV], [pipenv command])
AC_CHECK_PROGS([PIPENV], pipenv)
AS_IF([test "x$enable_docs" != "xno"],[
AC_CHECK_PROGS(bundle_cmd, bundle)
AC_CACHE_CHECK([for Python dependencies], [jq_cv_python_deps],[
jq_cv_python_deps=yes
AS_IF([test "x$PIPENV" = "x" || \
! bmsg="`cd ${srcdir}/docs; LC_ALL=$LANG "$PIPENV" --venv`"],[
jq_cv_python_deps=no
])
])
AC_CACHE_CHECK([for Ruby dependencies], [jq_cv_ruby_deps],
[jq_cv_ruby_deps=yes;
AS_IF([test "x$bundle_cmd" = "x" || \
! bmsg="`cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null`"],[
AC_MSG_WARN([$bmsg])
cat <<EOF
AS_IF([test "x$jq_cv_python_deps" != "xyes"], [
AC_MSG_WARN([Error checking python dependencies: $bmsg
*****************************************************************
* Ruby dependencies for building jq documentation not found. *
* Python dependencies for building jq documentation not found. *
* You can still build, install and hack on jq, but the manpage *
* will not be rebuilt and some of the tests will not run. *
* will not be rebuilt and new manpage tests will not be run. *
* See docs/README.md for how to install the docs dependencies. *
*****************************************************************
EOF
jq_cv_ruby_deps=no
])])
*****************************************************************])
enable_docs=no
])
])
if test "x$jq_cv_ruby_deps" != "xyes"; then
enable_docs=no
fi
dnl Disable decNumber support
AC_ARG_ENABLE([decnum],
AS_HELP_STRING([--disable-decnum],[disable decnum support]))
AS_IF([test "x$enable_decnum" != "xno"],[
AC_DEFINE([USE_DECNUM],1)
])
AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" != xno])
@@ -118,6 +123,15 @@ AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
AM_CONDITIONAL([ENABLE_ERROR_INJECTION], [test "x$enable_error_injection" = xyes])
AM_CONDITIONAL([ENABLE_ALL_STATIC], [test "x$enable_all_static" = xyes])
dnl Find pthread, if we have it. We do this first because we may set -pthread on CFLAGS
dnl which can cause various macros to be defined (__REENTRANT on Darwin, for example)
AX_PTHREAD([
AC_DEFINE([HAVE_PTHREAD], [1])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
])
AC_FUNC_ALLOCA
AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
@@ -130,23 +144,17 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])
AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])
AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])],
[], [[#include <time.h>]])
AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],
[], [[#include <time.h>]])
AC_FIND_FUNC([setlocale], [c], [#include <locale.h>], [0,0])
AC_ARG_ENABLE([pthread-tls],
[AC_HELP_STRING([--enable-pthread-tls],
[Enable use of pthread thread local storage])],
[],
[enable_pthread_tls=no])
if test $enable_pthread_tls = yes; then
AC_FIND_FUNC([pthread_key_create], [pthread], [#include <pthread.h>], [NULL, NULL])
AC_FIND_FUNC([pthread_once], [pthread], [#include <pthread.h>], [NULL, NULL])
AC_FIND_FUNC([atexit], [pthread], [#include <stdlib.h>], [NULL])
fi
dnl Figure out if we have the pthread functions we actually need
AC_FIND_FUNC_NO_LIBS([pthread_key_create], [], [#include <pthread.h>], [NULL, NULL])
AC_FIND_FUNC_NO_LIBS([pthread_once], [], [#include <pthread.h>], [NULL, NULL])
AC_FIND_FUNC_NO_LIBS([atexit], [], [#include <stdlib.h>], [NULL])
dnl libm math.h functions
AC_CHECK_MATH_FUNC(acos)
@@ -165,6 +173,7 @@ AC_CHECK_MATH_FUNC(drem)
AC_CHECK_MATH_FUNC(erf)
AC_CHECK_MATH_FUNC(erfc)
AC_CHECK_MATH_FUNC(exp10)
AC_CHECK_MATH_FUNC(__exp10) dnl macOS has an __exp10
AC_CHECK_MATH_FUNC(exp2)
AC_CHECK_MATH_FUNC(exp)
AC_CHECK_MATH_FUNC(expm1)
@@ -201,6 +210,10 @@ AC_CHECK_MATH_FUNC(round)
AC_CHECK_MATH_FUNC(scalb)
AC_CHECK_MATH_FUNC(scalbln)
AC_CHECK_MATH_FUNC(significand)
dnl scalbn and ilogb are used on macos to replace significand if we don't have frexp
AC_CHECK_MATH_FUNC(scalbn)
AC_CHECK_MATH_FUNC(ilogb)
AC_CHECK_MATH_FUNC(sin)
AC_CHECK_MATH_FUNC(sinh)
AC_CHECK_MATH_FUNC(sqrt)
@@ -227,8 +240,8 @@ AC_MSG_RESULT($have___thread)
AC_C_BIGENDIAN(
AC_DEFINE([IEEE_MC68k], 1, [machine is bigendian]),
AC_DEFINE([IEEE_8087], 1, [machine is littleendian]),
AC_MSG_ERROR(unknown endianess),
AC_MSG_ERROR(universial endianess not supported)
AC_MSG_ERROR(unknown endianness),
AC_MSG_ERROR(universal endianness not supported)
)
dnl Oniguruma
@@ -276,9 +289,10 @@ AC_SUBST(onig_CFLAGS)
AC_SUBST(onig_LDFLAGS)
AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])
AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" != xno])
AC_SUBST([BUNDLER], ["$bundle_cmd"])
AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_MACRO_DIRS([config/m4 m4])
AC_CONFIG_FILES([Makefile libjq.pc])
AC_OUTPUT
-6
View File
@@ -1,6 +0,0 @@
.DS_Store
.sass-cache
output/*
# Autogenerated from public/css/base.scss
public/css/base.css
-7
View File
@@ -1,7 +0,0 @@
source "https://rubygems.org"
gem "rake"
gem "bonsai"
gem "maruku"
gem "ronn"
gem "mustache", "<1.0" # to support ruby <2.0
-63
View File
@@ -1,63 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.3)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
bonsai (1.4.9)
activesupport (>= 3.0.3)
builder (>= 3.0.0)
i18n (>= 0.5.0)
launchy (>= 0.3.7)
liquid (>= 2.2.2)
maruku (>= 0.6.0)
rack
sass
sinatra (>= 1.0)
tilt (>= 1.3)
watch (>= 0.1.0)
yui-compressor
builder (3.2.2)
hpricot (0.8.6)
i18n (0.7.0)
json (1.8.3)
launchy (2.4.3)
addressable (~> 2.3)
liquid (3.0.6)
maruku (0.7.2)
minitest (5.8.0)
mustache (0.99.8)
rack (1.6.4)
rack-protection (1.5.3)
rack
rake (10.4.2)
rdiscount (2.1.8)
ronn (0.7.3)
hpricot (>= 0.8.2)
mustache (>= 0.7.0)
rdiscount (>= 1.5.8)
sass (3.4.16)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
thread_safe (0.3.5)
tilt (2.0.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
watch (0.1.0)
yui-compressor (0.12.0)
PLATFORMS
ruby
DEPENDENCIES
bonsai
maruku
mustache (< 1.0)
rake
ronn
+14
View File
@@ -0,0 +1,14 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
jinja2 = "*"
pyyaml = "*"
markdown = "*"
lxml = "*"
jsonschema = "*"
importlib_resources = "*"
+402
View File
@@ -0,0 +1,402 @@
{
"_meta": {
"hash": {
"sha256": "14036c3c9f103c52a0c5a53346ef33c2fbef409697f9eb314da51ccdd3aa9fb2"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"attrs": {
"hashes": [
"sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04",
"sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"
],
"markers": "python_version >= '3.7'",
"version": "==23.1.0"
},
"importlib-metadata": {
"hashes": [
"sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb",
"sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"
],
"markers": "python_version < '3.10'",
"version": "==6.8.0"
},
"importlib-resources": {
"hashes": [
"sha256:4cf94875a8368bd89531a756df9a9ebe1f150e0f885030b461237bc7f2d905f2",
"sha256:d952faee11004c045f785bb5636e8f885bed30dc3c940d5d42798a2a4541c185"
],
"index": "pypi",
"version": "==6.0.0"
},
"jinja2": {
"hashes": [
"sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852",
"sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"
],
"index": "pypi",
"version": "==3.1.2"
},
"jsonschema": {
"hashes": [
"sha256:971be834317c22daaa9132340a51c01b50910724082c2c1a2ac87eeec153a3fe",
"sha256:fb3642735399fa958c0d2aad7057901554596c63349f4f6b283c493cf692a25d"
],
"index": "pypi",
"version": "==4.18.4"
},
"jsonschema-specifications": {
"hashes": [
"sha256:05adf340b659828a004220a9613be00fa3f223f2b82002e273dee62fd50524b1",
"sha256:c91a50404e88a1f6ba40636778e2ee08f6e24c5613fe4c53ac24578a5a7f72bb"
],
"markers": "python_version >= '3.8'",
"version": "==2023.7.1"
},
"lxml": {
"hashes": [
"sha256:05186a0f1346ae12553d66df1cfce6f251589fea3ad3da4f3ef4e34b2d58c6a3",
"sha256:075b731ddd9e7f68ad24c635374211376aa05a281673ede86cbe1d1b3455279d",
"sha256:081d32421db5df44c41b7f08a334a090a545c54ba977e47fd7cc2deece78809a",
"sha256:0a3d3487f07c1d7f150894c238299934a2a074ef590b583103a45002035be120",
"sha256:0bfd0767c5c1de2551a120673b72e5d4b628737cb05414f03c3277bf9bed3305",
"sha256:0c0850c8b02c298d3c7006b23e98249515ac57430e16a166873fc47a5d549287",
"sha256:0e2cb47860da1f7e9a5256254b74ae331687b9672dfa780eed355c4c9c3dbd23",
"sha256:120fa9349a24c7043854c53cae8cec227e1f79195a7493e09e0c12e29f918e52",
"sha256:1247694b26342a7bf47c02e513d32225ededd18045264d40758abeb3c838a51f",
"sha256:141f1d1a9b663c679dc524af3ea1773e618907e96075262726c7612c02b149a4",
"sha256:14e019fd83b831b2e61baed40cab76222139926b1fb5ed0e79225bc0cae14584",
"sha256:1509dd12b773c02acd154582088820893109f6ca27ef7291b003d0e81666109f",
"sha256:17a753023436a18e27dd7769e798ce302963c236bc4114ceee5b25c18c52c693",
"sha256:1e224d5755dba2f4a9498e150c43792392ac9b5380aa1b845f98a1618c94eeef",
"sha256:1f447ea5429b54f9582d4b955f5f1985f278ce5cf169f72eea8afd9502973dd5",
"sha256:23eed6d7b1a3336ad92d8e39d4bfe09073c31bfe502f20ca5116b2a334f8ec02",
"sha256:25f32acefac14ef7bd53e4218fe93b804ef6f6b92ffdb4322bb6d49d94cad2bc",
"sha256:2c74524e179f2ad6d2a4f7caf70e2d96639c0954c943ad601a9e146c76408ed7",
"sha256:303bf1edce6ced16bf67a18a1cf8339d0db79577eec5d9a6d4a80f0fb10aa2da",
"sha256:3331bece23c9ee066e0fb3f96c61322b9e0f54d775fccefff4c38ca488de283a",
"sha256:3e9bdd30efde2b9ccfa9cb5768ba04fe71b018a25ea093379c857c9dad262c40",
"sha256:411007c0d88188d9f621b11d252cce90c4a2d1a49db6c068e3c16422f306eab8",
"sha256:42871176e7896d5d45138f6d28751053c711ed4d48d8e30b498da155af39aebd",
"sha256:46f409a2d60f634fe550f7133ed30ad5321ae2e6630f13657fb9479506b00601",
"sha256:48628bd53a426c9eb9bc066a923acaa0878d1e86129fd5359aee99285f4eed9c",
"sha256:48d6ed886b343d11493129e019da91d4039826794a3e3027321c56d9e71505be",
"sha256:4930be26af26ac545c3dffb662521d4e6268352866956672231887d18f0eaab2",
"sha256:4aec80cde9197340bc353d2768e2a75f5f60bacda2bab72ab1dc499589b3878c",
"sha256:4c28a9144688aef80d6ea666c809b4b0e50010a2aca784c97f5e6bf143d9f129",
"sha256:4d2d1edbca80b510443f51afd8496be95529db04a509bc8faee49c7b0fb6d2cc",
"sha256:4dd9a263e845a72eacb60d12401e37c616438ea2e5442885f65082c276dfb2b2",
"sha256:4f1026bc732b6a7f96369f7bfe1a4f2290fb34dce00d8644bc3036fb351a4ca1",
"sha256:4fb960a632a49f2f089d522f70496640fdf1218f1243889da3822e0a9f5f3ba7",
"sha256:50670615eaf97227d5dc60de2dc99fb134a7130d310d783314e7724bf163f75d",
"sha256:50baa9c1c47efcaef189f31e3d00d697c6d4afda5c3cde0302d063492ff9b477",
"sha256:53ace1c1fd5a74ef662f844a0413446c0629d151055340e9893da958a374f70d",
"sha256:5515edd2a6d1a5a70bfcdee23b42ec33425e405c5b351478ab7dc9347228f96e",
"sha256:56dc1f1ebccc656d1b3ed288f11e27172a01503fc016bcabdcbc0978b19352b7",
"sha256:578695735c5a3f51569810dfebd05dd6f888147a34f0f98d4bb27e92b76e05c2",
"sha256:57aba1bbdf450b726d58b2aea5fe47c7875f5afb2c4a23784ed78f19a0462574",
"sha256:57d6ba0ca2b0c462f339640d22882acc711de224d769edf29962b09f77129cbf",
"sha256:5c245b783db29c4e4fbbbfc9c5a78be496c9fea25517f90606aa1f6b2b3d5f7b",
"sha256:5c31c7462abdf8f2ac0577d9f05279727e698f97ecbb02f17939ea99ae8daa98",
"sha256:64f479d719dc9f4c813ad9bb6b28f8390360660b73b2e4beb4cb0ae7104f1c12",
"sha256:65299ea57d82fb91c7f019300d24050c4ddeb7c5a190e076b5f48a2b43d19c42",
"sha256:6689a3d7fd13dc687e9102a27e98ef33730ac4fe37795d5036d18b4d527abd35",
"sha256:690dafd0b187ed38583a648076865d8c229661ed20e48f2335d68e2cf7dc829d",
"sha256:6fc3c450eaa0b56f815c7b62f2b7fba7266c4779adcf1cece9e6deb1de7305ce",
"sha256:704f61ba8c1283c71b16135caf697557f5ecf3e74d9e453233e4771d68a1f42d",
"sha256:71c52db65e4b56b8ddc5bb89fb2e66c558ed9d1a74a45ceb7dcb20c191c3df2f",
"sha256:71d66ee82e7417828af6ecd7db817913cb0cf9d4e61aa0ac1fde0583d84358db",
"sha256:7d298a1bd60c067ea75d9f684f5f3992c9d6766fadbc0bcedd39750bf344c2f4",
"sha256:8b77946fd508cbf0fccd8e400a7f71d4ac0e1595812e66025bac475a8e811694",
"sha256:8d7e43bd40f65f7d97ad8ef5c9b1778943d02f04febef12def25f7583d19baac",
"sha256:8df133a2ea5e74eef5e8fc6f19b9e085f758768a16e9877a60aec455ed2609b2",
"sha256:8ed74706b26ad100433da4b9d807eae371efaa266ffc3e9191ea436087a9d6a7",
"sha256:92af161ecbdb2883c4593d5ed4815ea71b31fafd7fd05789b23100d081ecac96",
"sha256:97047f0d25cd4bcae81f9ec9dc290ca3e15927c192df17331b53bebe0e3ff96d",
"sha256:9719fe17307a9e814580af1f5c6e05ca593b12fb7e44fe62450a5384dbf61b4b",
"sha256:9767e79108424fb6c3edf8f81e6730666a50feb01a328f4a016464a5893f835a",
"sha256:9a92d3faef50658dd2c5470af249985782bf754c4e18e15afb67d3ab06233f13",
"sha256:9bb6ad405121241e99a86efff22d3ef469024ce22875a7ae045896ad23ba2340",
"sha256:9e28c51fa0ce5674be9f560c6761c1b441631901993f76700b1b30ca6c8378d6",
"sha256:aca086dc5f9ef98c512bac8efea4483eb84abbf926eaeedf7b91479feb092458",
"sha256:ae8b9c6deb1e634ba4f1930eb67ef6e6bf6a44b6eb5ad605642b2d6d5ed9ce3c",
"sha256:b0a545b46b526d418eb91754565ba5b63b1c0b12f9bd2f808c852d9b4b2f9b5c",
"sha256:b4e4bc18382088514ebde9328da057775055940a1f2e18f6ad2d78aa0f3ec5b9",
"sha256:b6420a005548ad52154c8ceab4a1290ff78d757f9e5cbc68f8c77089acd3c432",
"sha256:b86164d2cff4d3aaa1f04a14685cbc072efd0b4f99ca5708b2ad1b9b5988a991",
"sha256:bb3bb49c7a6ad9d981d734ef7c7193bc349ac338776a0360cc671eaee89bcf69",
"sha256:bef4e656f7d98aaa3486d2627e7d2df1157d7e88e7efd43a65aa5dd4714916cf",
"sha256:c0781a98ff5e6586926293e59480b64ddd46282953203c76ae15dbbbf302e8bb",
"sha256:c2006f5c8d28dee289f7020f721354362fa304acbaaf9745751ac4006650254b",
"sha256:c41bfca0bd3532d53d16fd34d20806d5c2b1ace22a2f2e4c0008570bf2c58833",
"sha256:cd47b4a0d41d2afa3e58e5bf1f62069255aa2fd6ff5ee41604418ca925911d76",
"sha256:cdb650fc86227eba20de1a29d4b2c1bfe139dc75a0669270033cb2ea3d391b85",
"sha256:cef2502e7e8a96fe5ad686d60b49e1ab03e438bd9123987994528febd569868e",
"sha256:d27be7405547d1f958b60837dc4c1007da90b8b23f54ba1f8b728c78fdb19d50",
"sha256:d37017287a7adb6ab77e1c5bee9bcf9660f90ff445042b790402a654d2ad81d8",
"sha256:d3ff32724f98fbbbfa9f49d82852b159e9784d6094983d9a8b7f2ddaebb063d4",
"sha256:d73d8ecf8ecf10a3bd007f2192725a34bd62898e8da27eb9d32a58084f93962b",
"sha256:dd708cf4ee4408cf46a48b108fb9427bfa00b9b85812a9262b5c668af2533ea5",
"sha256:e3cd95e10c2610c360154afdc2f1480aea394f4a4f1ea0a5eacce49640c9b190",
"sha256:e4da8ca0c0c0aea88fd46be8e44bd49716772358d648cce45fe387f7b92374a7",
"sha256:eadfbbbfb41b44034a4c757fd5d70baccd43296fb894dba0295606a7cf3124aa",
"sha256:ed667f49b11360951e201453fc3967344d0d0263aa415e1619e85ae7fd17b4e0",
"sha256:f3df3db1d336b9356dd3112eae5f5c2b8b377f3bc826848567f10bfddfee77e9",
"sha256:f6bdac493b949141b733c5345b6ba8f87a226029cbabc7e9e121a413e49441e0",
"sha256:fbf521479bcac1e25a663df882c46a641a9bff6b56dc8b0fafaebd2f66fb231b",
"sha256:fc9b106a1bf918db68619fdcd6d5ad4f972fdd19c01d19bdb6bf63f3589a9ec5",
"sha256:fcdd00edfd0a3001e0181eab3e63bd5c74ad3e67152c84f93f13769a40e073a7",
"sha256:fe4bda6bd4340caa6e5cf95e73f8fea5c4bfc55763dd42f1b50a94c1b4a2fbd4"
],
"index": "pypi",
"version": "==4.9.3"
},
"markdown": {
"hashes": [
"sha256:065fd4df22da73a625f14890dd77eb8040edcbd68794bcd35943be14490608b2",
"sha256:8bf101198e004dc93e84a12a7395e31aac6a9c9942848ae1d99b9d72cf9b3520"
],
"index": "pypi",
"version": "==3.4.3"
},
"markupsafe": {
"hashes": [
"sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e",
"sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e",
"sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431",
"sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686",
"sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559",
"sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc",
"sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c",
"sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0",
"sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4",
"sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9",
"sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575",
"sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba",
"sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d",
"sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3",
"sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00",
"sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155",
"sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac",
"sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52",
"sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f",
"sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8",
"sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b",
"sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24",
"sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea",
"sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198",
"sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0",
"sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee",
"sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be",
"sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2",
"sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707",
"sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6",
"sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58",
"sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779",
"sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636",
"sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c",
"sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad",
"sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee",
"sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc",
"sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2",
"sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48",
"sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7",
"sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e",
"sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b",
"sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa",
"sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5",
"sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e",
"sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb",
"sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9",
"sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57",
"sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc",
"sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"
],
"markers": "python_version >= '3.7'",
"version": "==2.1.3"
},
"pkgutil-resolve-name": {
"hashes": [
"sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174",
"sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e"
],
"markers": "python_version < '3.9'",
"version": "==1.3.10"
},
"pyyaml": {
"hashes": [
"sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc",
"sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741",
"sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206",
"sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27",
"sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595",
"sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62",
"sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98",
"sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696",
"sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d",
"sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867",
"sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47",
"sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486",
"sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6",
"sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3",
"sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007",
"sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938",
"sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c",
"sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735",
"sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d",
"sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba",
"sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8",
"sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5",
"sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd",
"sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3",
"sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0",
"sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515",
"sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c",
"sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c",
"sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924",
"sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34",
"sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43",
"sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859",
"sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673",
"sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a",
"sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab",
"sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa",
"sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c",
"sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585",
"sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d",
"sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f"
],
"index": "pypi",
"version": "==6.0.1"
},
"referencing": {
"hashes": [
"sha256:47237742e990457f7512c7d27486394a9aadaf876cbfaa4be65b27b4f4d47c6b",
"sha256:c257b08a399b6c2f5a3510a50d28ab5dbc7bbde049bcaf954d43c446f83ab548"
],
"markers": "python_version >= '3.8'",
"version": "==0.30.0"
},
"rpds-py": {
"hashes": [
"sha256:0173c0444bec0a3d7d848eaeca2d8bd32a1b43f3d3fde6617aac3731fa4be05f",
"sha256:01899794b654e616c8625b194ddd1e5b51ef5b60ed61baa7a2d9c2ad7b2a4238",
"sha256:02938432352359805b6da099c9c95c8a0547fe4b274ce8f1a91677401bb9a45f",
"sha256:03421628f0dc10a4119d714a17f646e2837126a25ac7a256bdf7c3943400f67f",
"sha256:03975db5f103997904c37e804e5f340c8fdabbb5883f26ee50a255d664eed58c",
"sha256:0766babfcf941db8607bdaf82569ec38107dbb03c7f0b72604a0b346b6eb3298",
"sha256:07e2c54bef6838fa44c48dfbc8234e8e2466d851124b551fc4e07a1cfeb37260",
"sha256:0836d71ca19071090d524739420a61580f3f894618d10b666cf3d9a1688355b1",
"sha256:095b460e117685867d45548fbd8598a8d9999227e9061ee7f012d9d264e6048d",
"sha256:0e7521f5af0233e89939ad626b15278c71b69dc1dfccaa7b97bd4cdf96536bb7",
"sha256:0f2996fbac8e0b77fd67102becb9229986396e051f33dbceada3debaacc7033f",
"sha256:1054a08e818f8e18910f1bee731583fe8f899b0a0a5044c6e680ceea34f93876",
"sha256:13b602dc3e8dff3063734f02dcf05111e887f301fdda74151a93dbbc249930fe",
"sha256:141acb9d4ccc04e704e5992d35472f78c35af047fa0cfae2923835d153f091be",
"sha256:14c408e9d1a80dcb45c05a5149e5961aadb912fff42ca1dd9b68c0044904eb32",
"sha256:159fba751a1e6b1c69244e23ba6c28f879a8758a3e992ed056d86d74a194a0f3",
"sha256:190ca6f55042ea4649ed19c9093a9be9d63cd8a97880106747d7147f88a49d18",
"sha256:196cb208825a8b9c8fc360dc0f87993b8b260038615230242bf18ec84447c08d",
"sha256:1fcdee18fea97238ed17ab6478c66b2095e4ae7177e35fb71fbe561a27adf620",
"sha256:207f57c402d1f8712618f737356e4b6f35253b6d20a324d9a47cb9f38ee43a6b",
"sha256:24a81c177379300220e907e9b864107614b144f6c2a15ed5c3450e19cf536fae",
"sha256:29cd8bfb2d716366a035913ced99188a79b623a3512292963d84d3e06e63b496",
"sha256:2d8b3b3a2ce0eaa00c5bbbb60b6713e94e7e0becab7b3db6c5c77f979e8ed1f1",
"sha256:35da5cc5cb37c04c4ee03128ad59b8c3941a1e5cd398d78c37f716f32a9b7f67",
"sha256:44659b1f326214950a8204a248ca6199535e73a694be8d3e0e869f820767f12f",
"sha256:47c5f58a8e0c2c920cc7783113df2fc4ff12bf3a411d985012f145e9242a2764",
"sha256:4bd4dc3602370679c2dfb818d9c97b1137d4dd412230cfecd3c66a1bf388a196",
"sha256:4ea6b73c22d8182dff91155af018b11aac9ff7eca085750455c5990cb1cfae6e",
"sha256:50025635ba8b629a86d9d5474e650da304cb46bbb4d18690532dd79341467846",
"sha256:517cbf6e67ae3623c5127206489d69eb2bdb27239a3c3cc559350ef52a3bbf0b",
"sha256:5855c85eb8b8a968a74dc7fb014c9166a05e7e7a8377fb91d78512900aadd13d",
"sha256:5a46859d7f947061b4010e554ccd1791467d1b1759f2dc2ec9055fa239f1bc26",
"sha256:65a0583c43d9f22cb2130c7b110e695fff834fd5e832a776a107197e59a1898e",
"sha256:674c704605092e3ebbbd13687b09c9f78c362a4bc710343efe37a91457123044",
"sha256:682726178138ea45a0766907957b60f3a1bf3acdf212436be9733f28b6c5af3c",
"sha256:686ba516e02db6d6f8c279d1641f7067ebb5dc58b1d0536c4aaebb7bf01cdc5d",
"sha256:6a5d3fbd02efd9cf6a8ffc2f17b53a33542f6b154e88dd7b42ef4a4c0700fdad",
"sha256:6aa8326a4a608e1c28da191edd7c924dff445251b94653988efb059b16577a4d",
"sha256:700375326ed641f3d9d32060a91513ad668bcb7e2cffb18415c399acb25de2ab",
"sha256:71f2f7715935a61fa3e4ae91d91b67e571aeb5cb5d10331ab681256bda2ad920",
"sha256:745f5a43fdd7d6d25a53ab1a99979e7f8ea419dfefebcab0a5a1e9095490ee5e",
"sha256:79f594919d2c1a0cc17d1988a6adaf9a2f000d2e1048f71f298b056b1018e872",
"sha256:7d68dc8acded354c972116f59b5eb2e5864432948e098c19fe6994926d8e15c3",
"sha256:7f67da97f5b9eac838b6980fc6da268622e91f8960e083a34533ca710bec8611",
"sha256:83b32f0940adec65099f3b1c215ef7f1d025d13ff947975a055989cb7fd019a4",
"sha256:876bf9ed62323bc7dcfc261dbc5572c996ef26fe6406b0ff985cbcf460fc8a4c",
"sha256:890ba852c16ace6ed9f90e8670f2c1c178d96510a21b06d2fa12d8783a905193",
"sha256:8b08605d248b974eb02f40bdcd1a35d3924c83a2a5e8f5d0fa5af852c4d960af",
"sha256:8b2eb034c94b0b96d5eddb290b7b5198460e2d5d0c421751713953a9c4e47d10",
"sha256:8b9ec12ad5f0a4625db34db7e0005be2632c1013b253a4a60e8302ad4d462afd",
"sha256:8c8d7594e38cf98d8a7df25b440f684b510cf4627fe038c297a87496d10a174f",
"sha256:8d3335c03100a073883857e91db9f2e0ef8a1cf42dc0369cbb9151c149dbbc1b",
"sha256:8d70e8f14900f2657c249ea4def963bed86a29b81f81f5b76b5a9215680de945",
"sha256:9039a11bca3c41be5a58282ed81ae422fa680409022b996032a43badef2a3752",
"sha256:91378d9f4151adc223d584489591dbb79f78814c0734a7c3bfa9c9e09978121c",
"sha256:9251eb8aa82e6cf88510530b29eef4fac825a2b709baf5b94a6094894f252387",
"sha256:933a7d5cd4b84f959aedeb84f2030f0a01d63ae6cf256629af3081cf3e3426e8",
"sha256:978fa96dbb005d599ec4fd9ed301b1cc45f1a8f7982d4793faf20b404b56677d",
"sha256:987b06d1cdb28f88a42e4fb8a87f094e43f3c435ed8e486533aea0bf2e53d931",
"sha256:99b1c16f732b3a9971406fbfe18468592c5a3529585a45a35adbc1389a529a03",
"sha256:99e7c4bb27ff1aab90dcc3e9d37ee5af0231ed98d99cb6f5250de28889a3d502",
"sha256:9c439fd54b2b9053717cca3de9583be6584b384d88d045f97d409f0ca867d80f",
"sha256:9ea4d00850ef1e917815e59b078ecb338f6a8efda23369677c54a5825dbebb55",
"sha256:9f30d205755566a25f2ae0382944fcae2f350500ae4df4e795efa9e850821d82",
"sha256:a06418fe1155e72e16dddc68bb3780ae44cebb2912fbd8bb6ff9161de56e1798",
"sha256:a0805911caedfe2736935250be5008b261f10a729a303f676d3d5fea6900c96a",
"sha256:a1f044792e1adcea82468a72310c66a7f08728d72a244730d14880cd1dabe36b",
"sha256:a216b26e5af0a8e265d4efd65d3bcec5fba6b26909014effe20cd302fd1138fa",
"sha256:a987578ac5214f18b99d1f2a3851cba5b09f4a689818a106c23dbad0dfeb760f",
"sha256:aad51239bee6bff6823bbbdc8ad85136c6125542bbc609e035ab98ca1e32a192",
"sha256:ab2299e3f92aa5417d5e16bb45bb4586171c1327568f638e8453c9f8d9e0f020",
"sha256:ab6919a09c055c9b092798ce18c6c4adf49d24d4d9e43a92b257e3f2548231e7",
"sha256:b0c43f8ae8f6be1d605b0465671124aa8d6a0e40f1fb81dcea28b7e3d87ca1e1",
"sha256:b1440c291db3f98a914e1afd9d6541e8fc60b4c3aab1a9008d03da4651e67386",
"sha256:b52e7c5ae35b00566d244ffefba0f46bb6bec749a50412acf42b1c3f402e2c90",
"sha256:bf4151acb541b6e895354f6ff9ac06995ad9e4175cbc6d30aaed08856558201f",
"sha256:c27ee01a6c3223025f4badd533bea5e87c988cb0ba2811b690395dfe16088cfe",
"sha256:c545d9d14d47be716495076b659db179206e3fd997769bc01e2d550eeb685596",
"sha256:c5934e2833afeaf36bd1eadb57256239785f5af0220ed8d21c2896ec4d3a765f",
"sha256:c7671d45530fcb6d5e22fd40c97e1e1e01965fc298cbda523bb640f3d923b387",
"sha256:c861a7e4aef15ff91233751619ce3a3d2b9e5877e0fcd76f9ea4f6847183aa16",
"sha256:d25b1c1096ef0447355f7293fbe9ad740f7c47ae032c2884113f8e87660d8f6e",
"sha256:d55777a80f78dd09410bd84ff8c95ee05519f41113b2df90a69622f5540c4f8b",
"sha256:d576c3ef8c7b2d560e301eb33891d1944d965a4d7a2eacb6332eee8a71827db6",
"sha256:dd9da77c6ec1f258387957b754f0df60766ac23ed698b61941ba9acccd3284d1",
"sha256:de0b6eceb46141984671802d412568d22c6bacc9b230174f9e55fc72ef4f57de",
"sha256:e07e5dbf8a83c66783a9fe2d4566968ea8c161199680e8ad38d53e075df5f0d0",
"sha256:e564d2238512c5ef5e9d79338ab77f1cbbda6c2d541ad41b2af445fb200385e3",
"sha256:ed89861ee8c8c47d6beb742a602f912b1bb64f598b1e2f3d758948721d44d468",
"sha256:ef1f08f2a924837e112cba2953e15aacfccbbfcd773b4b9b4723f8f2ddded08e",
"sha256:f411330a6376fb50e5b7a3e66894e4a39e60ca2e17dce258d53768fea06a37bd",
"sha256:f68996a3b3dc9335037f82754f9cdbe3a95db42bde571d8c3be26cc6245f2324",
"sha256:f7fdf55283ad38c33e35e2855565361f4bf0abd02470b8ab28d499c663bc5d7c",
"sha256:f963c6b1218b96db85fc37a9f0851eaf8b9040aa46dec112611697a7023da535",
"sha256:fa2818759aba55df50592ecbc95ebcdc99917fa7b55cc6796235b04193eb3c55",
"sha256:fae5cb554b604b3f9e2c608241b5d8d303e410d7dfb6d397c335f983495ce7f6",
"sha256:fb39aca7a64ad0c9490adfa719dbeeb87d13be137ca189d2564e596f8ba32c07"
],
"markers": "python_version >= '3.8'",
"version": "==0.9.2"
},
"zipp": {
"hashes": [
"sha256:679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0",
"sha256:ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147"
],
"markers": "python_version < '3.10'",
"version": "==3.16.2"
}
},
"develop": {}
}
+15 -14
View File
@@ -2,24 +2,25 @@ Documentation
=============
The jq website, manpages and some of the tests are generated from this
directory. The directory holds a [Bonsai](http://tinytree.info)
website, and the manual is a YAML file in `content/3.manual`.
directory. The manual is a YAML file in `content/manual`.
To build the documentation (including building the jq manpage), you'll
need a working Ruby setup. The easiest way to get one is to install
RVM and Ruby 1.9.3 like so:
need `python3` and `pipenv`. You can install `pipenv` like so:
\curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3
pip install pipenv
After that finishes installing, you'll need to make sure RVM is on
your path by doing `source $HOME/.rvm/scripts/rvm`, or just opening a
new shell. See <https://rvm.io> for more info on RVM.
Though, you may need to say `pip3` instead, depending on your system. Once
you have `pipenv` installed, you can install the dependencies by running
`pipenv sync` from the `docs/` directory.
Once RVM is installed, you can install all the dependencies for jq's
documentation build by running this from the `docs` directory:
Also, you may need to run `virtualenv -p /usr/bin/python3 venv/` and
then `source venv/bin/activate`, and only then `pipenv sync`.
bundle install
Once this is done, rerun `./configure` in the jq root directory and then
the `Makefile` will be able to generate the jq manpage. You can just run
`make jq.1` to build the manpage manually, and `make tests/man.test` to
update the manual tests.
When bundle manages to install the dependencies, rerun `./configure`
in the jq root directory and then the Makefile will be able to
generate the jq manpage.
To build the website, run `pipenv run python3 build_website.py --root /output`
in the `docs/` directory. To serve them locally, you can run
`python3 -m http.server`.
-24
View File
@@ -1,24 +0,0 @@
current_dir = File.dirname(__FILE__)
rakefile_manual = File.expand_path(File.join(current_dir, "Rakefile.manual"))
rakefile_website = File.expand_path(File.join(current_dir, "Rakefile.website"))
desc "Build the manpage from the bonsai source of the manual"
task :manpage do
system %(#{$0} -f #{rakefile_manual} manpage)
end
desc "Collect jq unit test cases from the bonsai source of the manual"
task :mantests do
system %(#{$0} -f #{rakefile_manual} mantests)
end
desc "Build the website from the bonsai sources"
task :build do
system %(#{$0} -f #{rakefile_website} build)
end
desc "Serve a live view of the website on http://localhost:5000/jq/"
task :serve do
system %(#{$0} -f #{rakefile_website} serve)
end
-49
View File
@@ -1,49 +0,0 @@
require 'ronn'
require 'tempfile'
require 'yaml'
def load_manual
YAML::load(File.open("content/3.manual/manual.yml"))
end
task :manpage do
Tempfile.open "manpage" do |f|
manual = load_manual
f.puts manual['manpage_intro']
f.puts manual['body']
manual['sections'].each do |section|
f.puts "## #{section['title'].upcase}\n"
f.puts section['body']
f.puts ""
(section['entries'] || []).each do |entry|
f.puts "### #{entry['title']}\n"
f.puts entry['body']
f.puts ""
(entry['examples'] || []).each do |example|
f.puts " jq '#{example['program']}'"
f.puts " #{example['input']}"
f.puts " => #{example['output'].join(", ")}"
f.puts
end
end
f.puts ""
end
f.puts manual['manpage_epilogue']
f.close
puts Ronn::Document.new(f.path).convert('roff').gsub(/<\/?code>/,"")
end
end
task :mantests do
load_manual['sections'].each do |section|
(section['entries'] || []).each do |entry|
(entry['examples'] || []).each do |example|
puts example['program'].gsub("\n", " ")
puts example['input']
example['output'].each do |s| puts s end
puts
end
end
end
end
-76
View File
@@ -1,76 +0,0 @@
require 'bonsai'
require 'json'
require 'liquid'
require 'maruku'
module ExtraFilters
def markdownify(input)
Maruku.new(input).to_html
end
def search_id(input)
input.gsub(/`/, '')
end
def section_id(input)
input.gsub(/[^a-zA-Z0-9_]/, '')
end
def entry_id(input)
input.gsub(/[ `]/, '')
end
def no_paragraph(input)
input.gsub('<p>', '').gsub('</p>', '')
end
def json(input)
input.to_json
end
def unique(input)
@n = (@n || 0) + 1
input + @n.to_s
end
end
Liquid::Template.register_filter(ExtraFilters)
begin
`java 2>&1`
rescue
class Bonsai::Exporter
def self.compress_assets
Bonsai.log "java not found! Not compressing javascript or stylesheets"
end
end
end
task :build do
Bonsai.root_dir = Dir.pwd
Bonsai::Exporter.publish!
end
task :serve do
begin
Bonsai.log "Press Control+C to quit"
require 'rack'
require 'sinatra'
require 'watch'
require 'launchy'
Bonsai.root_dir = Dir.pwd
server = fork {
app = Rack::Builder.app {
map "/jq" do
use Bonsai::StaticPassThrough, :root => Bonsai.root_dir + "/output", :urls => ["/"]
end
run Bonsai::DevelopmentServer
}
Rack::Handler.default.run(app, :Port => 5000) do
Launchy.open("http://localhost:5000/jq/")
end
}
Watch.new("{content,templates,public}/**/*") { Bonsai::Exporter.process! }
rescue Interrupt
Process.kill("QUIT", server)
Process.wait(server)
exit
end
end
+248
View File
@@ -0,0 +1,248 @@
#!/usr/bin/env python3
from datetime import date
from io import StringIO
from lxml import etree
import markdown
from markdown.extensions import Extension
import re
import sys
import yaml
# Prevent our markdown parser from trying to help by interpreting things in angle brackets as HTML tags.
class EscapeHtml(Extension):
def extendMarkdown(self, md):
md.preprocessors.deregister('html_block')
md.inlinePatterns.deregister('html')
class RoffWalker(object):
def __init__(self, tree, output=sys.stdout):
self.tree = tree
self.target = output
self.f = StringIO()
def walk(self):
self._walk(self.tree, parent_tag=None)
# We don't want to start lines with \. because that can confuse man
# For lines that start with \., we need to prefix them with \& so it
# knows not to treat that line as a directive
data = re.sub(r'^\\\.', r'\&.', self.f.getvalue(), flags=re.MULTILINE)
self.target.write(data)
def _ul_is_special(self, root):
if len(root) != 1:
return False
child = root[0]
if child.tag != 'li':
return False
msg = ''.join(child.itertext()).strip()
return msg.endswith(':')
def _walk_child(self, root):
if len(root) > 0:
self._walk(root[0], parent_tag=root.tag)
def _write_element(self, root, ensure_newline=True):
if root.text is not None:
text = self._sanitize(root.text)
self.__write_raw(text)
self._walk_child(root)
self._write_tail(root, ensure_newline=ensure_newline)
def _write_tail(self, root, ensure_newline=False, inline=False):
if root.tail is not None:
if inline or root.tail != '\n':
text = self._sanitize(root.tail)
if text.endswith('\n'):
ensure_newline = False
self.__write_raw(text)
if ensure_newline:
self.__write_raw('\n')
def _walk(self, root, parent_tag=None):
last_tag = None
while root is not None:
if root.tag == 'h1':
self.__write_cmd('.TH "JQ" "1" "{}" "" ""'.format(
date.today().strftime('%B %Y')))
self.__write_cmd('.SH "NAME"')
# TODO: properly parse this
self.__write_raw(r'\fBjq\fR \- Command\-line JSON processor' +
"\n")
elif root.tag == 'h2':
self.__write_cmd('.SH "{}"'.format(''.join(
root.itertext()).strip()))
elif root.tag == 'h3':
text = ''.join(root.itertext()).strip()
self.__write_cmd('.SS "{}"'.format(self._h3_sanitize(text)))
elif root.tag == 'p':
if last_tag not in ['h2', 'h3'] and parent_tag not in ['li']:
self.__write_cmd('.P')
self._write_element(root, ensure_newline=(parent_tag != 'li'))
elif root.tag == 'ul':
if self._ul_is_special(root):
li = root[0]
self.__write_cmd('.TP')
self._write_element(li)
next = root.getnext()
while next is not None and next.tag == 'p':
if next.getnext() is not None and next.getnext(
).tag == 'pre':
# we don't want to .IP these, because it'll look funny with the code indent
break
self.__write_cmd('.IP')
self._write_element(next)
root = next
next = root.getnext()
else:
self._walk_child(root)
self._write_tail(root)
# A pre tag after the end of a list doesn't want two of the indentation commands
if root.getnext() is None or root.getnext().tag != 'pre':
self.__write_cmd('.IP "" 0')
elif root.tag == 'li':
self.__write_cmd(r'.IP "\(bu" 4')
if root.text is not None and root.text.strip() != '':
text = self._sanitize(root.text)
self.__write_raw(text)
self._walk_child(root)
self._write_tail(root, ensure_newline=True)
elif root.tag == 'strong':
if root.text is not None:
text = self._sanitize(root.text)
self.__write_raw('\\fB{}\\fR'.format(text))
self._write_tail(root, inline=True)
elif root.tag == 'em':
if root.text is not None:
text = self._sanitize(root.text)
self.__write_raw('\\fI{}\\fR'.format(text))
self._write_tail(root, inline=True)
elif root.tag == 'code':
if root.text is not None:
text = self._code_sanitize(root.text)
self.__write_raw('\\fB{}\\fR'.format(text))
self._write_tail(root, inline=True)
elif root.tag == 'pre':
self.__write_cmd('.IP "" 4')
self.__write_cmd('.nf\n') # extra newline for spacing reasons
next = root
first = True
while next is not None and next.tag == 'pre':
if not first:
self.__write_raw('\n')
text = ''.join(next.itertext(with_tail=False))
self.__write_raw(self._pre_sanitize(text))
first = False
root = next
next = next.getnext()
self.__write_cmd('.fi')
self.__write_cmd('.IP "" 0')
else:
self._walk_child(root)
last_tag = root.tag
root = root.getnext()
def _base_sanitize(self, text):
text = re.sub(r'\\', r'\\e', text)
text = re.sub(r'\.', r'\\.', text)
text = re.sub("'", r"\'", text)
text = re.sub('-', r'\-', text)
return text
def _pre_sanitize(self, text):
return self._base_sanitize(text)
def _code_sanitize(self, text):
text = self._base_sanitize(text)
text = re.sub(r'\s', ' ', text)
return text
def _h3_sanitize(self, text):
text = self._base_sanitize(text)
text = re.sub(' \n|\n ', ' ', text)
text = re.sub('\n', ' ', text)
return text
def _sanitize(self, text):
text = self._base_sanitize(text)
text = re.sub(r'<([^>]+)>', r'\\fI\1\\fR', text)
text = re.sub(r' +', ' ', text)
text = re.sub('\n', ' ', text)
return text
def __write_cmd(self, dat):
print('.', dat, sep='\n', file=self.f)
pass
def __write_raw(self, dat):
print(dat, sep='', end='', file=self.f)
pass
def load_yml_file(fn):
with open(fn) as f:
return yaml.safe_load(f)
def dedent_body(body):
lines = [re.sub(r'^ (\S)', r'\1', l) for l in body.split('\n')]
return '\n'.join(lines)
def convert_manual_to_markdown():
f = StringIO()
manual = load_yml_file("content/manual/manual.yml")
f.write(manual.get('manpage_intro', '\n'))
f.write(dedent_body(manual.get('body', '\n')))
for section in manual.get('sections', []):
f.write('## {}\n'.format(section.get('title', '').upper()))
f.write(dedent_body(section.get('body', '\n')))
f.write('\n')
for entry in section.get('entries', []):
f.write('### {}\n'.format(entry.get('title', '')))
f.write(dedent_body(entry.get('body', '\n')))
f.write('\n')
if entry.get('examples') is not None:
f.write("~~~~\n")
first = True
for example in entry.get('examples'):
if not first:
f.write('\n')
f.write("jq '{}'\n".format(example.get('program', '')))
f.write(" {}\n".format(example.get('input', '')))
output = [str(x) for x in example.get('output', [])]
f.write("=> {}\n".format(', '.join(output)))
first = False
f.write("~~~~\n")
f.write('\n')
f.write(manual.get('manpage_epilogue', ''))
return f.getvalue()
# Convert manual.yml to our special markdown format
markdown_data = convert_manual_to_markdown()
# Convert markdown to html
html_data = markdown.markdown(markdown_data,
extensions=[EscapeHtml(), 'fenced_code'])
# Parse the html into a tree so we can walk it
tr = etree.HTML(html_data, etree.HTMLParser())
# Convert the markdown to ROFF
RoffWalker(tr).walk()
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
import yaml
import re
regex_program_pattern = re.compile(
r'\b(?:test|match|capture|scan|split|splits|sub|gsub)\s*\(')
with open('content/manual/manual.yml') as source, \
open('../tests/man.test', 'w') as man, \
open('../tests/manonig.test', 'w') as manonig:
manual = yaml.safe_load(source)
for section in manual.get('sections', []):
for entry in section.get('entries', []):
for example in entry.get('examples', []):
program = example.get('program', '').replace('\n', ' ')
out = manonig if regex_program_pattern.search(program) else man
print(program, file=out)
print(example.get('input', ''), file=out)
for s in example.get('output', []):
print(s, file=out)
print('', file=out)
+95
View File
@@ -0,0 +1,95 @@
#!/usr/bin/env python3
import argparse
import glob
import itertools
from jinja2 import Environment, FileSystemLoader, select_autoescape, pass_context
from markdown import markdown
from markupsafe import Markup
import os
import os.path
import re
import shutil
import yaml
parser = argparse.ArgumentParser()
parser.add_argument('--root', default='/jq')
args = parser.parse_args()
env = Environment(
loader=FileSystemLoader('templates'),
autoescape=select_autoescape(['html.j2']),
)
def load_yml_file(fn):
with open(fn) as f:
return yaml.safe_load(f)
env.globals['url'] = 'https://jqlang.github.io/jq'
env.globals['root'] = args.root
env.filters['search_id'] = lambda input: input.replace(r'`', '')
env.filters['section_id'] = lambda input: re.sub(
r'[^-a-zA-Z0-9_]', '', input.replace(' ', '-')).lower()
env.filters['entry_id'] = lambda input: re.sub(
r'^(split|first-last-nth)$',
r'\1' + ('-1' if ';' not in input else '-2'), # avoid id conflict
re.sub(
r'\b([^-]+)(?:-\1)+\b',
r'\1', # e.g. range-range-range -> range
re.sub(r' ?/ ?|,? ', '-',
re.sub(r'[`;]|: .*|\(.*?\)| \[.+\]', '', input)))).lower()
env.filters['markdownify'] = lambda input: Markup(markdown(input))
env.filters['no_paragraph'] = lambda input: Markup(re.sub(r'</?p>', '', input))
env.globals['unique_id'] = pass_context(
lambda ctx: str(next(ctx['unique_ctr'])))
def raise_handler(message):
raise Exception(message)
env.globals['raise'] = raise_handler
def generate_file(env, fname):
path, base = os.path.split(fname)
path = os.path.relpath(path, 'content')
if path == '.':
path = ''
permalink = ''
else:
permalink = path + '/'
output_dir = os.path.join('output', path)
output_path = os.path.join(output_dir, 'index.html')
template_name = re.sub(r'.yml$', '.html.j2', base)
ctx = load_yml_file(fname)
ctx.update(unique_ctr=itertools.count(1),
permalink=permalink,
navitem=path)
os.makedirs(output_dir, exist_ok=True)
env.get_template(template_name).stream(ctx).dump(output_path,
encoding='utf-8')
def copy_public_files(root=''):
for f in os.scandir(os.path.join('public', root)):
src = os.path.join(root, f.name)
dst = os.path.join('output', src)
if f.is_dir():
os.makedirs(dst, exist_ok=True)
copy_public_files(src)
else:
shutil.copyfile(f.path, dst)
os.makedirs('output', exist_ok=True)
copy_public_files()
for fn in glob.glob('content/**/*.yml', recursive=True):
generate_file(env, fn)
-327
View File
@@ -1,327 +0,0 @@
headline: Tutorial
body:
- text: |
GitHub has a JSON API, so let's play with that. This URL gets us the last
5 commits from the jq repo.
- command: "curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5'"
result: |
[
{
"sha": "d25341478381063d1c76e81b3a52e0592a7c997f",
"commit": {
"author": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"committer": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"tree": {
"sha": "6ab697a8dfb5a96e124666bf6d6213822599fb40",
"url": "https://api.github.com/repos/stedolan/jq/git/trees/6ab697a8dfb5a96e124666bf6d6213822599fb40"
},
"url": "https://api.github.com/repos/stedolan/jq/git/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"comment_count": 0
},
"url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"html_url": "https://github.com/stedolan/jq/commit/d25341478381063d1c76e81b3a52e0592a7c997f",
"comments_url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f/comments",
"author": {
"login": "stedolan",
...
- text: |
GitHub returns nicely formatted JSON. For servers that don't, it can be
helpful to pipe the response through jq to pretty-print it. The simplest
jq program is the expression `.`, which takes the input and produces it
unchanged as output.
- command: "curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.'"
result: |
[
{
"sha": "d25341478381063d1c76e81b3a52e0592a7c997f",
"commit": {
"author": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"committer": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"tree": {
"sha": "6ab697a8dfb5a96e124666bf6d6213822599fb40",
"url": "https://api.github.com/repos/stedolan/jq/git/trees/6ab697a8dfb5a96e124666bf6d6213822599fb40"
},
"url": "https://api.github.com/repos/stedolan/jq/git/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"comment_count": 0
},
"url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"html_url": "https://github.com/stedolan/jq/commit/d25341478381063d1c76e81b3a52e0592a7c997f",
"comments_url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f/comments",
"author": {
"login": "stedolan",
...
- text: |
We can use jq to extract just the first commit.
- command: "curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.[0]'"
result: |
{
"sha": "d25341478381063d1c76e81b3a52e0592a7c997f",
"commit": {
"author": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"committer": {
"name": "Stephen Dolan",
"email": "mu@netsoc.tcd.ie",
"date": "2013-06-22T16:30:59Z"
},
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"tree": {
"sha": "6ab697a8dfb5a96e124666bf6d6213822599fb40",
"url": "https://api.github.com/repos/stedolan/jq/git/trees/6ab697a8dfb5a96e124666bf6d6213822599fb40"
},
"url": "https://api.github.com/repos/stedolan/jq/git/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"comment_count": 0
},
"url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f",
"html_url": "https://github.com/stedolan/jq/commit/d25341478381063d1c76e81b3a52e0592a7c997f",
"comments_url": "https://api.github.com/repos/stedolan/jq/commits/d25341478381063d1c76e81b3a52e0592a7c997f/comments",
"author": {
"login": "stedolan",
"id": 79765,
"avatar_url": "https://avatars.githubusercontent.com/u/79765?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/stedolan",
"html_url": "https://github.com/stedolan",
"followers_url": "https://api.github.com/users/stedolan/followers",
"following_url": "https://api.github.com/users/stedolan/following{/other_user}",
"gists_url": "https://api.github.com/users/stedolan/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stedolan/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stedolan/subscriptions",
"organizations_url": "https://api.github.com/users/stedolan/orgs",
"repos_url": "https://api.github.com/users/stedolan/repos",
"events_url": "https://api.github.com/users/stedolan/events{/privacy}",
"received_events_url": "https://api.github.com/users/stedolan/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "stedolan",
"id": 79765,
"avatar_url": "https://avatars.githubusercontent.com/u/79765?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/stedolan",
"html_url": "https://github.com/stedolan",
"followers_url": "https://api.github.com/users/stedolan/followers",
"following_url": "https://api.github.com/users/stedolan/following{/other_user}",
"gists_url": "https://api.github.com/users/stedolan/gists{/gist_id}",
"starred_url": "https://api.github.com/users/stedolan/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/stedolan/subscriptions",
"organizations_url": "https://api.github.com/users/stedolan/orgs",
"repos_url": "https://api.github.com/users/stedolan/repos",
"events_url": "https://api.github.com/users/stedolan/events{/privacy}",
"received_events_url": "https://api.github.com/users/stedolan/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "54b9c9bdb225af5d886466d72f47eafc51acb4f7",
"url": "https://api.github.com/repos/stedolan/jq/commits/54b9c9bdb225af5d886466d72f47eafc51acb4f7",
"html_url": "https://github.com/stedolan/jq/commit/54b9c9bdb225af5d886466d72f47eafc51acb4f7"
},
{
"sha": "8b1b503609c161fea4b003a7179b3fbb2dd4345a",
"url": "https://api.github.com/repos/stedolan/jq/commits/8b1b503609c161fea4b003a7179b3fbb2dd4345a",
"html_url": "https://github.com/stedolan/jq/commit/8b1b503609c161fea4b003a7179b3fbb2dd4345a"
}
]
}
- text: |
For the rest of the examples, I'll leave out the `curl` command - it's not
going to change.
There's a lot of info we don't care about there, so we'll restrict it down
to the most interesting fields.
- command: "jq '.[0] | {message: .commit.message, name: .commit.committer.name}'"
result: |
{
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"name": "Stephen Dolan"
}
- text: |
The `|` operator in jq feeds the output of one filter (`.[0]` which gets
the first element of the array in the response) into the input of another
(`{...}` which builds an object out of those fields). You can access
nested attributes, such as `.commit.message`.
Now let's get the rest of the commits.
- command: "jq '.[] | {message: .commit.message, name: .commit.committer.name}'"
result: |
{
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"name": "Stephen Dolan"
}
{
"message": "Reject all overlong UTF8 sequences.",
"name": "Stephen Dolan"
}
{
"message": "Fix various UTF8 parsing bugs.\n\nIn particular, parse bad UTF8 by replacing the broken bits with U+FFFD\nand resychronise correctly after broken sequences.",
"name": "Stephen Dolan"
}
{
"message": "Fix example in manual for `floor`. See #155.",
"name": "Stephen Dolan"
}
{
"message": "Document floor",
"name": "Nicolas Williams"
}
- text: |
`.[]` returns each element of the array returned in the response, one at a
time, which are all fed into
`{message: .commit.message, name: .commit.committer.name}`.
Data in jq is represented as streams of JSON values - every jq
expression runs for each value in its input stream, and can
produce any number of values to its output stream.
Streams are serialised by just separating JSON values with
whitespace. This is a `cat`-friendly format - you can just join
two JSON streams together and get a valid JSON stream.
If you want to get the output as a single array, you can tell jq to
"collect" all of the answers by wrapping the filter in square
brackets:
- command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name}]'"
result: |
[
{
"message": "Merge pull request #163 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"name": "Stephen Dolan"
},
{
"message": "Reject all overlong UTF8 sequences.",
"name": "Stephen Dolan"
},
{
"message": "Fix various UTF8 parsing bugs.\n\nIn particular, parse bad UTF8 by replacing the broken bits with U+FFFD\nand resychronise correctly after broken sequences.",
"name": "Stephen Dolan"
},
{
"message": "Fix example in manual for `floor`. See #155.",
"name": "Stephen Dolan"
},
{
"message": "Document floor",
"name": "Nicolas Williams"
}
]
- text: |
- - -
Next, let's try getting the URLs of the parent commits out of the
API results as well. In each commit, the GitHub API includes information
about "parent" commits. There can be one or many.
"parents": [
{
"sha": "54b9c9bdb225af5d886466d72f47eafc51acb4f7",
"url": "https://api.github.com/repos/stedolan/jq/commits/54b9c9bdb225af5d886466d72f47eafc51acb4f7",
"html_url": "https://github.com/stedolan/jq/commit/54b9c9bdb225af5d886466d72f47eafc51acb4f7"
},
{
"sha": "8b1b503609c161fea4b003a7179b3fbb2dd4345a",
"url": "https://api.github.com/repos/stedolan/jq/commits/8b1b503609c161fea4b003a7179b3fbb2dd4345a",
"html_url": "https://github.com/stedolan/jq/commit/8b1b503609c161fea4b003a7179b3fbb2dd4345a"
}
]
We want to pull out all of the "html_url" fields inside that array of parent
commits and make a simple list of strings to go along with the
"message" and "author" fields we already have.
- command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name, parents: [.parents[].html_url]}]'"
result: |
[
{
"message": "Merge pull request #162 from stedolan/utf8-fixes\n\nUtf8 fixes. Closes #161",
"name": "Stephen Dolan",
"parents": [
"https://github.com/stedolan/jq/commit/54b9c9bdb225af5d886466d72f47eafc51acb4f7",
"https://github.com/stedolan/jq/commit/8b1b503609c161fea4b003a7179b3fbb2dd4345a"
]
},
{
"message": "Reject all overlong UTF8 sequences.",
"name": "Stephen Dolan",
"parents": [
"https://github.com/stedolan/jq/commit/ff48bd6ec538b01d1057be8e93b94eef6914e9ef"
]
},
{
"message": "Fix various UTF8 parsing bugs.\n\nIn particular, parse bad UTF8 by replacing the broken bits with U+FFFD\nand resychronise correctly after broken sequences.",
"name": "Stephen Dolan",
"parents": [
"https://github.com/stedolan/jq/commit/54b9c9bdb225af5d886466d72f47eafc51acb4f7"
]
},
{
"message": "Fix example in manual for `floor`. See #155.",
"name": "Stephen Dolan",
"parents": [
"https://github.com/stedolan/jq/commit/3dcdc582ea993afea3f5503a78a77675967ecdfa"
]
},
{
"message": "Document floor",
"name": "Nicolas Williams",
"parents": [
"https://github.com/stedolan/jq/commit/7c4171d414f647ab08bcd20c76a4d8ed68d9c602"
]
}
]
- text: |
Here we're making an object as before, but this time the `parents`
field is being set to `[.parents[].html_url]`, which collects
all of the parent commit URLs defined in the parents object.
- text: |
- - -
Here endeth the tutorial! There's lots more to play with. Go
read [the manual](../manual/) if you're interested, and [download
jq](../download/) if you haven't already.
-193
View File
@@ -1,193 +0,0 @@
headline: Download jq
body:
- text: |
jq is written in C and has no runtime dependencies, so it should be
possible to build it for nearly any platform. Prebuilt binaries are
available for Linux, OS X and Windows.
The binaries should just run, but on OS X and Linux you may need
to make them executable first using `chmod +x jq`.
jq is licensed under the MIT license. For all of the gory
details, read the file `COPYING` in the source distribution.
### Linux
* jq 1.5 is in the official [Debian](https://packages.debian.org/jq) and
[Ubuntu](http://packages.ubuntu.com/jq) repositories. Install using
`sudo apt-get install jq`.
* jq 1.5 is in the official
[Fedora](http://pkgs.fedoraproject.org/cgit/jq.git/) repository.
Install using `sudo dnf install jq`.
* jq 1.4 is in the official [openSUSE](https://software.opensuse.org/package/jq)
repository. Install using `sudo zypper install jq`.
* jq 1.5 is in the official
[Arch](https://www.archlinux.org/packages/?sort=&q=jq&maintainer=&flagged=)
repository. Install using `sudo pacman -Sy jq`.
* jq 1.6 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux32).
* jq 1.5 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux32).
* jq 1.4 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-linux-x86_64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-linux-x86).
* jq 1.3 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-linux-x86_64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-linux-x86).
### OS X
* Use [Homebrew](http://brew.sh/) to install jq 1.5 with
`brew install jq`.
* jq 1.6 binary for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64).
* jq 1.5 binary for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64).
* jq 1.4 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-osx-x86_64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-osx-x86).
* jq 1.3 binaries for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-osx-x86_64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-osx-x86).
### FreeBSD
* `pkg install jq` as root installs a pre-built
[binary package](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html).
* `make -C /usr/ports/textproc/jq install clean` as root installs the
[jq](https://www.freshports.org/textproc/jq/)
[port](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html)
from source.
### Solaris
* `pkgutil -i jq` in [OpenCSW](https://www.opencsw.org/p/jq) for Solaris
10+, Sparc and x86.
* jq 1.4 binaries for Solaris 11
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-solaris11-64)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-solaris11-32).
### Windows
* Use [Chocolatey NuGet](https://chocolatey.org/) to install jq 1.5 with
`chocolatey install jq`.
* jq 1.6 executables for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win32.exe).
* jq 1.5 executables for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-win64.exe)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-win32.exe).
* jq 1.4 executables for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-win64.exe)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.4/jq-win32.exe).
* jq 1.3 executables for
[64-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-win64.exe)
or
[32-bit](https://github.com/stedolan/jq/releases/download/jq-1.3/jq-win32.exe).
### Checksums and signatures
SHA-256 checksums are provided for all release and pre-release binaries.
They can be found under
[sig/v1.x/sha256sum.txt](https://github.com/stedolan/jq/tree/master/sig).
The checksums for jq 1.6 are in
[sig/v1.6/sha256sum.txt](https://raw.githubusercontent.com/stedolan/jq/master/sig/v1.6/sha256sum.txt).
The checksums for jq 1.5 are in
[sig/v1.5/sha256sum.txt](https://raw.githubusercontent.com/stedolan/jq/master/sig/v1.5/sha256sum.txt).
Additionally, all binaries are signed by the
[jq Package Signing Key](https://raw.githubusercontent.com/stedolan/jq/master/sig/jq-release.key).
The signatures can be found under
[sig/v1.x/\*.asc](https://github.com/stedolan/jq/tree/master/sig).
The signatures for jq 1.6 are in
[sig/v1.5/\*.asc](https://github.com/stedolan/jq/tree/master/sig/v1.6).
The signatures for jq 1.5 are in
[sig/v1.5/\*.asc](https://github.com/stedolan/jq/tree/master/sig/v1.5).
You can use [GnuPG](https://gnupg.org/) to verify a signature by downloading
the signature and running `gpg --verify signature.asc`.
### From source on Linux, OS X, Cygwin, and other POSIX-like operating systems
* [Source tarball for jq 1.6](https://github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz)
* [Source tarball for jq 1.5](https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz)
You can build it using the usual `./configure && make && sudo
make install` rigmarole.
If you're interested in using the lastest development version, try:
git clone https://github.com/stedolan/jq.git
cd jq
autoreconf -i
./configure --disable-maintainer-mode
make
sudo make install
To build it from a git clone, you'll need to install a few
packages first:
* [GCC](https://gcc.gnu.org)
* [Make](https://www.gnu.org/software/make/)
* [Autotools](https://www.gnu.org/software/automake/)
For Linux systems, these will all be in your system's package
manager, and if you do development on the machine they're most
likely already installed.
On OS X, these are all included in Apple's command line tools, which can
be installed from [Xcode](https://developer.apple.com/xcode/). However,
you may find that you need a newer version of Bison than the one provided
by Apple. This can be found in [Homebrew](http://brew.sh) or
[MacPorts](https://macports.org/).
The `--disable-maintainer-mode` flag says to use the pre-generated lexer
and parser that come with the code. To compile the lexer and parser also
from source, leave out this flag. You will need to install
[Flex](http://flex.sourceforge.net/) and
[Bison](https://www.gnu.org/software/bison/).
#### Building the documentation
jq's documentation is compiled into static HTML using
[Bonsai](http://www.tinytree.info). To view the documentation
locally, run `rake serve` (or `bundle exec rake serve`) from the
docs/ subdirectory. To build the docs just `rake build` from the
docs subdirectory. You'll need a few Ruby dependencies, which can
be installed by following the instructions in `docs/README.md`.
The man page is built by `make jq.1`, or just `make`, also from
the YAML docs, and you'll still need the Ruby dependencies to
build the manpage.
+207
View File
@@ -0,0 +1,207 @@
headline: Download jq
body:
- text: |
jq is written in C and has no runtime dependencies, so it should be
possible to build it for nearly any platform. Prebuilt binaries are
available for Linux, macOS and Windows.
The binaries should just run, but on macOS and Linux you may need
to make them executable first using `chmod +x jq`.
jq is licensed under the MIT license. For all of the gory
details, read the file `COPYING` in the source distribution.
jq uses a C library for decimal number support. This is an ICU 1.8.1
licensed code obtained from the ICU downloads archive
http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip.
### Linux
* jq is in the official [Debian](https://packages.debian.org/jq) and
[Ubuntu](http://packages.ubuntu.com/jq) repositories. Install using
`sudo apt-get install jq`.
* jq is in the official [Fedora](https://src.fedoraproject.org/rpms/jq) repository.
Install using `sudo dnf install jq`.
* jq is in the official [openSUSE](https://software.opensuse.org/package/jq) repository.
Install using `sudo zypper install jq`.
* jq is in the official [Arch](https://archlinux.org/packages/?q=jq) repository.
Install using `sudo pacman -S jq`.
* jq 1.6 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux32).
* jq 1.5 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux32).
* jq 1.4 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86_64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86).
* jq 1.3 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86_64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86).
### macOS
* Use [Homebrew](http://brew.sh/) to install jq with `brew install jq`.
* Use [MacPorts](https://www.macports.org) to install jq with `port install jq`.
* Use [Fink](https://finkproject.org) to install jq with `fink install jq`.
* jq 1.6 binary for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64).
* jq 1.5 binary for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-osx-amd64).
* jq 1.4 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86_64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86).
* jq 1.3 binaries for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86_64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86).
### FreeBSD
* `pkg install jq` as root installs a pre-built
[binary package](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html).
* `make -C /usr/ports/textproc/jq install clean` as root installs the
[jq](https://www.freshports.org/textproc/jq/)
[port](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html)
from source.
### Solaris
* `pkgutil -i jq` in [OpenCSW](https://www.opencsw.org/p/jq) for Solaris
10+, Sparc and x86.
* jq 1.4 binaries for Solaris 11
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-64)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-32).
### Windows
* Use [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/)
to install jq with `winget install jqlang.jq`.
* Use [scoop](https://scoop.sh/) to install jq with `scoop install jq`.
* Use [Chocolatey NuGet](https://chocolatey.org/) to install jq with
`chocolatey install jq`.
* jq 1.6 executables for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win32.exe).
* jq 1.5 executables for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win64.exe)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win32.exe).
* jq 1.4 executables for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win64.exe)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win32.exe).
* jq 1.3 executables for
[64-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win64.exe)
or
[32-bit](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win32.exe).
### Checksums and signatures
SHA-256 checksums are provided for all release and pre-release binaries.
They can be found under
[sig/v1.x/sha256sum.txt](https://github.com/jqlang/jq/tree/master/sig).
The checksums for jq 1.6 are in
[sig/v1.6/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.6/sha256sum.txt).
The checksums for jq 1.5 are in
[sig/v1.5/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.5/sha256sum.txt).
Additionally, all release artifacts are signed by a jq release key. We have two release keys, [one for 1.6 and older releases](https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-old.key), and [one for 1.7 and newer releases](https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-new.key).
Signatures can be found under
[sig/v1.x/\*.asc](https://github.com/jqlang/jq/tree/master/sig).
The signatures for jq 1.7rc are in
[sig/v1.7rc1/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.7rc1).
The signatures for jq 1.6 are in
[sig/v1.6/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.6).
The signatures for jq 1.5 are in
[sig/v1.5/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.5).
You can use [GnuPG](https://gnupg.org/) to verify a signature by downloading
the signature and running `gpg --verify signature.asc`.
### From source on Linux, macOS, Cygwin, and other POSIX-like operating systems
* [Source tarball for jq 1.6](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-1.6.tar.gz)
* [Source tarball for jq 1.5](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-1.5.tar.gz)
You can build it using the usual `./configure && make && sudo
make install` rigmarole.
If you're interested in using the latest development version, try:
git clone --recursive https://github.com/jqlang/jq.git
cd jq
autoreconf -i
./configure
make
sudo make install
To build it from a git clone, you'll need to install a few
packages first:
* [GCC](https://gcc.gnu.org)
* [Make](https://www.gnu.org/software/make/)
* [Autotools](https://www.gnu.org/software/automake/)
For Linux systems, these will all be in your system's package
manager, and if you do development on the machine they're most
likely already installed.
On macOS, these are all included in Apple's command line tools, which can
be installed from [Xcode](https://developer.apple.com/xcode/). However,
you may find that you need a newer version of Bison than the one provided
by Apple. This can be found in [Homebrew](http://brew.sh) or
[MacPorts](https://macports.org/).
If you want to generate the lexer and parser from source you can use the
`--enable-maintainer-mode` configure flag. This requires bison to be installed.
[Flex](https://github.com/westes/flex) and
[Bison](https://www.gnu.org/software/bison/).
### Docker
Docker image is available from
[GitHub Container Registry](https://github.com/jqlang/jq/pkgs/container/jq).
docker run -i --rm ghcr.io/jqlang/jq -n 'range(3)'
#### Building the documentation
jq's documentation is compiled into static HTML using Python.
To build the docs, run `pipenv run python3 build_website.py --root /output`
in the `docs/` directory. To serve them locally, you can run
`python3 -m http.server`. You'll need a few Python dependencies,
which can be installed by following the instructions in `docs/README.md`.
The man page is built by `make jq.1`, or just `make`, also from
the YAML docs, and you'll still need the Python dependencies to
build the manpage.
+71
View File
@@ -0,0 +1,71 @@
headline: jq
blurb: |
jq is a lightweight and flexible command-line JSON processor.
body1: |
jq is like `sed` for JSON data - you can use it to slice and filter
and map and transform structured data with the same ease that `sed`,
`awk`, `grep` and friends let you play with text.
body2: |
jq is written in portable C, and it has zero runtime
dependencies. You can download a single binary, `scp` it to a far away
machine of the same type, and expect it to work.
body3: |
jq can mangle the data format that you have into the one that you
want with very little effort, and the program to do so is often
shorter and simpler than you'd expect.
tail: |
Go read the [tutorial](./tutorial/) for more, or the [manual](./manual/)
for *way* more.
Have a question related to jq? You can seek answers on [Stack Overflow](https://stackoverflow.com/)
by using the [jq tag](https://stackoverflow.com/questions/tagged/jq), or in the [#jq channel](https://web.libera.chat/#jq)
on [Libera.Chat](https://libera.chat/). For more interactive discussions, feel free to join our [Discord server](https://discord.gg/yg6yjNmgAC).
news:
- date: 1 November 2018
body: |
jq 1.6 released. See installation options on the [download](./download/)
page, and the [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.6)
for details.
- date: 15 August 2015
body: |
jq 1.5 released, including new datetime, math, and regexp functions,
try/catch syntax, array and object destructuring, a streaming parser,
and a module system. See installation options on the
[download](./download/) page, and the
[release notes](https://github.com/jqlang/jq/releases/tag/jq-1.5)
for details.
- date: 26 July 2015
body: |
jq 1.5rc2 is available. Get it on the
[releases](https://github.com/jqlang/jq/releases) page.
- date: 01 January 2015
body: |
jq 1.5rc1 is available. Get it on the
[releases](https://github.com/jqlang/jq/releases) page.
- date: 09 June 2014
body: |
jq 1.4 (finally) released! Get it on the [download](./download/) page.
- date: 19 May 2013
body: |
jq 1.3 released.
-73
View File
@@ -1,73 +0,0 @@
headline: jq
blurb: |
jq is a lightweight and flexible command-line JSON processor.
body1: |
jq is like `sed` for JSON data - you can use it to slice and filter
and map and transform structured data with the same ease that `sed`,
`awk`, `grep` and friends let you play with text.
body2: |
jq is written in portable C, and it has zero runtime
dependencies. You can download a single binary, `scp` it to a far away
machine of the same type, and expect it to work.
body3: |
jq can mangle the data format that you have into the one that you
want with very little effort, and the program to do so is often
shorter and simpler than you'd expect.
tail: |
Go read the [tutorial](/jq/tutorial/) for more, or the [manual](/jq/manual/)
for *way* more.
Ask questions on [stackoverflow](https://stackoverflow.com/) using the [jq
tag](https://stackoverflow.com/questions/tagged/jq), or on the
[#jq](http://irc.lc/freenode/%23jq/) channel on
[Freenode](https://webchat.freenode.net/).
news:
- date: 1 November 2018
body: |
jq 1.6 released. See installation options on the [download](/jq/download/)
page, and the [release notes](https://github.com/stedolan/jq/releases/tag/jq-1.6)
for details.
- date: 15 August 2015
body: |
jq 1.5 released, including new datetime, math, and regexp functions,
try/catch syntax, array and object destructuring, a streaming parser,
and a module system. See installation options on the
[download](/jq/download/) page, and the
[release notes](https://github.com/stedolan/jq/releases/tag/jq-1.5)
for details.
- date: 26 July 2015
body: |
jq 1.5rc2 is available. Get it on the
[releases](https://github.com/stedolan/jq/releases) page.
- date: 01 January 2015
body: |
jq 1.5rc1 is available. Get it on the
[releases](https://github.com/stedolan/jq/releases) page.
- date: 09 June 2014
body: |
jq 1.4 (finally) released! Get it on the [download](/jq/download/) page.
- date: 19 May 2013
body: |
jq 1.3 released.
File diff suppressed because it is too large. Load diff
@@ -4,7 +4,7 @@ headline: jq 1.3 Manual
history: |
*The manual for the development version of jq can be found
[here](/jq/manual).*
[here](../).*
body: |
@@ -63,7 +63,7 @@ manpage_epilogue: |
Presumably. Report them or discuss them at:
https://github.com/stedolan/jq/issues
https://github.com/jqlang/jq/issues
## AUTHOR
@@ -76,30 +76,30 @@ sections:
jq filters run on a stream of JSON data. The input to jq is
parsed as a sequence of whitespace-separated JSON values which
are passed through the provided filter one at a time. The
output(s) of the filter are written to standard out, again as a
sequence of whitespace-separated JSON data.
output(s) of the filter are written to standard output, as a
sequence of newline-separated JSON data.
You can affect how jq reads and writes its input and output
using some command-line options:
* `--slurp`/`-s`:
* `--null-input` / `-n`:
Instead of running the filter for each JSON object in the
input, read the entire input stream into a large array and run
the filter just once.
Don't read any input at all. Instead, the filter is run once
using `null` as the input. This is useful when using jq as a
simple calculator or to construct JSON data from scratch.
* `--raw-input`/`-R`:
* `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
* `--null-input`/`-n`:
* `--slurp` / `-s`:
Don't read any input at all! Instead, the filter is run once
using `null` as the input. This is useful when using jq as a
simple calculator or to construct JSON data from scratch.
Instead of running the filter for each JSON object in the
input, read the entire input stream into a large array and run
the filter just once.
* `--compact-output` / `-c`:
@@ -107,11 +107,12 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
* `--raw-output` / `-r`:
By default, jq outputs colored JSON if writing to a
terminal. You can force it to produce color even if writing to
a pipe or a file using `-C`, and disable color with `-M`.
With this option, if the filter's result is a string then it
will be written directly to standard output rather than being
formatted as a JSON string with quotes. This can be useful for
making jq filters talk to non-JSON-based systems.
* `--ascii-output` / `-a`:
@@ -121,12 +122,11 @@ sections:
ASCII output with every non-ASCII character replaced with the
equivalent escape sequence.
* `--raw-output` / `-r`:
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
With this option, if the filter's result is a string then it
will be written directly to standard output rather than being
formatted as a JSON string with quotes. This can be useful for
making jq filters talk to non-JSON-based systems.
By default, jq outputs colored JSON if writing to a
terminal. You can force it to produce color even if writing to
a pipe or a file using `-C`, and disable color with `-M`.
* `--arg name value`:
@@ -162,7 +162,7 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
output: [42]
output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
@@ -171,10 +171,9 @@ sections:
body: |
You can also look up fields of an object using syntax like
`.["foo"]` (.foo above is a shorthand version of this). This
one works for arrays as well, if the key is an
integer. Arrays are zero-based (like javascript), so `.[2]`
returns the third element of the array.
`.["foo"]` (`.foo` above is a shorthand version of this). This
one works for arrays as well, if the key is an integer. Arrays
are zero-based, so `.[2]` returns the third element of the array.
The `.[10:15]` syntax can be used to return a subarray of an
array. The array returned by `.[10:15]` will be of length 5,
@@ -279,13 +278,13 @@ sections:
hashes with only string keys), and "null".
Booleans, null, strings and numbers are written the same way as
in javascript. Just like everything else in jq, these simple
in JSON. Just like everything else in jq, these simple
values take an input and produce an output - `42` is a valid jq
expression that takes an input, ignores it, and returns 42
instead.
entries:
- title: Array construction - `[]`
- title: "Array construction: `[]`"
body: |
As in JSON, `[]` is used to construct arrays, as in
@@ -310,7 +309,7 @@ sections:
- program: "[.user, .projects[]]"
input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}'
output: ['["stedolan", "jq", "wikiflow"]']
- title: Objects - `{}`
- title: "Objects: `{}`"
body: |
Like JSON, `{}` is for constructing objects (aka
@@ -371,14 +370,14 @@ sections:
- title: Builtin operators and functions
body: |
Some jq operator (for instance, `+`) do different things
Some jq operators (for instance, `+`) do different things
depending on the type of their arguments (arrays, numbers,
etc.). However, jq never does implicit type conversions. If you
try to add a string to an object you'll get an error message and
no result.
entries:
- title: Addition - `+`
- title: "Addition: `+`"
body: |
The operator `+` takes two filters, applies them both
@@ -416,11 +415,11 @@ sections:
input: 'null'
output: ['{"a": 42, "b": 2, "c": 3}']
- title: Subtraction - `-`
- title: "Subtraction: `-`"
body: |
As well as normal arithmetic subtraction on numbers, the `-`
operator can be used on arrays to remove all occurences of
operator can be used on arrays to remove all occurrences of
the second array's elements from the first array.
examples:
@@ -431,17 +430,17 @@ sections:
input: '["xml", "yaml", "json"]'
output: ['["json"]']
- title: Multiplication, division - `*` and `/`
- title: "Multiplication, division: `*` and `/`"
body: |
These operators only work on numbers, and do the expected.
examples:
- program: '10 / . * 3'
input: 5
output: [6]
input: '5'
output: ['6']
- title: `length`
- title: '`length`'
body: |
The builtin function `length` gets the length of various
@@ -460,9 +459,9 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null]'
output: [2, 6, 1, 0]
output: ['2', '6', '1', '0']
- title: `keys`
- title: '`keys`'
body: |
The builtin function `keys`, when given an object, returns
@@ -485,7 +484,7 @@ sections:
input: '[42,3,35]'
output: ['[0,1,2]']
- title: `has`
- title: '`has`'
body: |
The builtin function `has` returns whether the input object
@@ -504,7 +503,7 @@ sections:
input: '[[0,1], ["a","b","c"]]'
output: ['[false, true]']
- title: `to_entries`, `from_entries`, `with_entries`
- title: "`to_entries`, `from_entries`, `with_entries(f)`"
body: |
These functions convert between an object and an array of
@@ -513,9 +512,9 @@ sections:
includes `{"key": k, "value": v}`.
`from_entries` does the opposite conversion, and
`with_entries(foo)` is a shorthand for `to_entries |
map(foo) | from_entries`, useful for doing some operation to
all keys and values of an object.
`with_entries(f)` is a shorthand for `to_entries | map(f) |
from_entries`, useful for doing some operation to all keys
and values of an object.
examples:
- program: 'to_entries'
@@ -529,14 +528,14 @@ sections:
output: ['{"KEY_a": 1, "KEY_b": 2}']
- title: `select`
- title: '`select`'
body: |
The function `select(foo)` produces its input unchanged if
`foo` returns true for that input, and produces no output
otherwise.
It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))`
It's useful for filtering lists: '`[1,2,3] | map(select(. >= 2))`'
will give you `[3]`.
examples:
@@ -544,7 +543,7 @@ sections:
input: '[1,5,3,0,7]'
output: ['[5,3,7]']
- title: `empty`
- title: '`empty`'
body: |
`empty` returns no results. None at all. Not even `null`.
@@ -554,19 +553,19 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
output: [1, 2]
output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
- title: `map(x)`
- title: '`map(f)`'
body: |
For any filter `x`, `map(x)` will run that filter for each
For any filter `f`, `map(f)` will run that filter for each
element of the input array, and produce the outputs a new
array. `map(.+1)` will increment each element of an array of numbers.
`map(x)` is equivalent to `[.[] | x]`. In fact, this is how
`map(f)` is equivalent to `[.[] | f]`. In fact, this is how
it's defined.
examples:
@@ -574,7 +573,7 @@ sections:
input: '[1,2,3]'
output: ['[2,3,4]']
- title: `add`
- title: '`add`'
body: |
The filter `add` takes as input an array, and produces as
@@ -591,12 +590,12 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
output: [6]
output: ['6']
- program: add
input: '[]'
output: ["null"]
- title: `range`
- title: '`range`'
body: |
The `range` function produces a range of numbers. `range(4;10)`
@@ -612,7 +611,7 @@ sections:
input: 'null'
output: ['[2,3]']
- title: `tonumber`
- title: '`tonumber`'
body: |
The `tonumber` function parses its input as a number. It
@@ -622,9 +621,9 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
output: [1, 1]
output: ['1', '1']
- title: `tostring`
- title: '`tostring`'
body: |
The `tostring` function prints its input as a
@@ -636,7 +635,7 @@ sections:
input: '[1, "1", [1]]'
output: ['"1"', '"1"', '"[1]"']
- title: `type`
- title: '`type`'
body: |
The `type` function returns the type of its argument as a
@@ -648,7 +647,7 @@ sections:
input: '[0, false, [], {}, null, "hello"]'
output: ['["number", "boolean", "array", "object", "null", "string"]']
- title: `sort, sort_by`
- title: '`sort`, `sort_by`'
body: |
The `sort` functions sorts its input, which must be an
@@ -680,7 +679,7 @@ sections:
input: '[{"foo":4, "bar":10}, {"foo":3, "bar":100}, {"foo":2, "bar":1}]'
output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":100}, {"foo":4, "bar":10}]']
- title: `group_by`
- title: '`group_by`'
body: |
`group_by(.foo)` takes as input an array, groups the
@@ -697,7 +696,7 @@ sections:
input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]'
output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]']
- title: `min`, `max`, `min_by`, `max_by`
- title: '`min`, `max`, `min_by`, `max_by`'
body: |
Find the minimum or maximum element of the input array. The
@@ -713,7 +712,7 @@ sections:
input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]'
output: ['{"foo":2, "bar":3}']
- title: `unique`
- title: '`unique`'
body: |
The `unique` function takes as input an array and produces
@@ -725,7 +724,7 @@ sections:
input: '[1,2,5,3,5,3,1,3]'
output: ['[1,2,3,5]']
- title: `reverse`
- title: '`reverse`'
body: |
This function reverses an array.
@@ -735,7 +734,7 @@ sections:
input: '[1,2,3,4]'
output: ['[4,3,2,1]']
- title: `contains`
- title: '`contains`'
body: |
The filter `contains(b)` will produce true if b is
@@ -764,7 +763,7 @@ sections:
input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}'
output: ['false']
- title: `recurse`
- title: '`recurse`'
body: |
The `recurse` function allows you to search through a
@@ -796,7 +795,7 @@ sections:
- '{"foo":[]}'
- title: "String interpolation - `\(foo)`"
- title: "String interpolation: `\\(exp)`"
body: |
Inside a string, you can put an expression inside parens
@@ -872,24 +871,20 @@ sections:
input: '"This works if x < y"'
output: ['"This works if x &lt; y"']
# - program: '@html "<span>Anonymous said: \(.)</span>"'
# input: '"<script>alert(\"lol hax\");</script>"'
# output: ["<span>Anonymous said: &lt;script&gt;alert(&quot;lol hax&quot;);&lt;/script&gt;</span>"]
- program: '@sh "echo \(.)"'
input: "\"O'Hara's Ale\""
output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""]
- title: Conditionals and Comparisons
entries:
- title: `==`, `!=`
- title: '`==`, `!=`'
body: |
The expression 'a == b' will produce 'true' if the result of a and b
are equal (that is, if they represent equivalent JSON documents) and
'false' otherwise. In particular, strings are never considered equal
to numbers. If you're coming from Javascript, jq's == is like
Javascript's === - considering values equal only when they have the
to numbers. If you're coming from JavaScript, jq's == is like
JavaScript's === - considering values equal only when they have the
same type as well as the same value.
!= is "not equal", and 'a != b' returns the opposite value of 'a == b'
@@ -898,7 +893,8 @@ sections:
- program: '.[] == 1'
input: '[1, 1.0, "1", "banana"]'
output: ['true', 'true', 'false', 'false']
- title: if-then-else
- title: if-then-else-end
body: |
`if A then B else C end` will act the same as `B` if `A`
@@ -906,11 +902,11 @@ sections:
as `C` otherwise.
Checking for false or null is a simpler notion of
"truthiness" than is found in Javascript or Python, but it
"truthiness" than is found in JavaScript or Python, but it
means that you'll sometimes have to be more explicit about
the condition you want: you can't test whether, e.g. a
string is empty using `if .name then A else B end`, you'll
need something more like `if (.name | count) > 0 then A else
need something more like `if (.name | length) > 0 then A else
B end` instead.
If the condition `A` produces multiple results, then `B` is evaluated
@@ -928,10 +924,10 @@ sections:
else
"many"
end
input: 2
input: '2'
output: ['"many"']
- title: `>, >=, <=, <`
- title: "`>`, `>=`, `<=`, `<`"
body: |
The comparison operators `>`, `>=`, `<=`, `<` return whether
@@ -943,15 +939,16 @@ sections:
examples:
- program: '. < 5'
input: 2
input: '2'
output: ['true']
- title: and/or/not
- title: "`and`, `or`, `not`"
body: |
jq supports the normal Boolean operators and/or/not. They have the
same standard of truth as if expressions - false and null are
considered "false values", and anything else is a "true value".
jq supports the normal Boolean operators `and`, `or`, `not`.
They have the same standard of truth as if expressions -
`false` and `null` are considered "false values", and
anything else is a "true value".
If an operand of one of these operators produces multiple
results, the operator itself will produce a result for each input.
@@ -961,12 +958,12 @@ sections:
rather than with special syntax, as in `.foo and .bar |
not`.
These three only produce the values "true" and "false", and
These three only produce the values `true` and `false`, and
so are only useful for genuine Boolean operations, rather
than the common Perl/Python/Ruby idiom of
"value_that_may_be_null or default". If you want to use this
form of "or", picking between two values rather than
evaluating a condition, see the "//" operator below.
evaluating a condition, see the `//` operator below.
examples:
- program: '42 and "a string"'
@@ -975,9 +972,6 @@ sections:
- program: '(true, false) or false'
input: 'null'
output: ['true', 'false']
# - program: '(true, false) and (true, false)'
# input: 'null'
# output: ['true', 'false', 'false', 'false']
- program: '(true, true) and (true, false)'
input: 'null'
output: ['true', 'false', 'true', 'false']
@@ -985,7 +979,7 @@ sections:
input: 'null'
output: ['[false, true]']
- title: Alternative operator - `//`
- title: "Alternative operator: `//`"
body: |
A filter of the form `a // b` produces the same
@@ -1001,10 +995,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
output: [19]
output: ['19']
- program: '.foo // 42'
input: '{}'
output: [42]
output: ['42']
- title: Advanced features
body: |
@@ -1020,7 +1014,7 @@ sections:
It is also possible to define functions in jq, although this is
is a feature whose biggest use is defining jq's standard library
(many jq functions such as `map` and `find` are in fact written
(many jq functions such as `map` and `select` are in fact written
in jq).
Finally, jq has a `reduce` operation, which is very powerful but a
@@ -1045,7 +1039,7 @@ sections:
produces its sum, and the `length` expression is given the array and
produces its length.
So, there's generally a cleaner way to solve most problems in jq that
So, there's generally a cleaner way to solve most problems in jq than
defining variables. Still, sometimes they do make things easier, so jq
lets you define variables using `expression as $variable`. All
variable names start with `$`. Here's a slightly uglier version of the
@@ -1061,7 +1055,7 @@ sections:
fields, and another object which is used to map author usernames to
real names. Our input looks like:
{"posts": [{"title": "Frist psot", "author": "anon"},
{"posts": [{"title": "First post", "author": "anon"},
{"title": "A well-written article", "author": "person1"}],
"realnames": {"anon": "Anonymous Coward",
"person1": "Person McPherson"}}
@@ -1069,7 +1063,7 @@ sections:
We want to produce the posts with the author field containing a real
name, as in:
{"title": "Frist psot", "author": "Anonymous Coward"}
{"title": "First post", "author": "Anonymous Coward"}
{"title": "A well-written article", "author": "Person McPherson"}
We use a variable, $names, to store the realnames object, so that we
@@ -1133,29 +1127,29 @@ sections:
input: '[[1,2],[10,20]]'
output: ['[[1,2,1,2], [10,20,1,2]]']
- title: Reduce
- title: "`reduce`"
body: |
The `reduce` syntax in jq allows you to combine all of the
results of an expression by accumulating them into a single
answer. As an example, we'll pass `[3,2,1]` to this expression:
The `reduce` syntax allows you to combine all of the results of
an expression by accumulating them into a single answer.
The form is `reduce EXP as $var (INIT; UPDATE)`.
As an example, we'll pass `[1,2,3]` to this expression:
reduce .[] as $item (0; . + $item)
For each result that `.[]` produces, `. + $item` is run to
accumulate a running total, starting from 0. In this
example, `.[]` produces the results 3, 2, and 1, so the
effect is similar to running something like this:
accumulate a running total, starting from 0 as the input value.
In this example, `.[]` produces the results `1`, `2`, and `3`,
so the effect is similar to running something like this:
0 | (3 as $item | . + $item) |
(2 as $item | . + $item) |
(1 as $item | . + $item)
0 | 1 as $item | . + $item |
2 as $item | . + $item |
3 as $item | . + $item
examples:
- program: 'reduce .[] as $item (0; . + $item)'
input: '[10,2,5,3]'
output: ['20']
input: '[1,2,3,4,5]'
output: ['15']
- title: Assignment
body: |
@@ -1169,7 +1163,7 @@ sections:
If an object has two fields which are arrays, `.foo` and `.bar`,
and you append something to `.foo`, then `.bar` will not get
bigger. Even if you've just set `.bar = .foo`. If you're used to
programming in languages like Python, Java, Ruby, Javascript,
programming in languages like Python, Java, Ruby, JavaScript,
etc. then you can think of it as though jq does a full deep copy
of every object before it does the assignment (for performance,
it doesn't actually do that, but that's the general idea).
@@ -1186,7 +1180,7 @@ sections:
.foo = .bar | .foo.baz = 1
will not have the side-effect of setting .bar.baz to be set
to 1, as the similar-looking program in Javascript, Python,
to 1, as the similar-looking program in JavaScript, Python,
Ruby or other languages would. Unlike these languages (but
like Haskell and some other functional languages), there is
no notion of two arrays or objects being "the same array" or
@@ -1232,7 +1226,7 @@ sections:
- title: Complex assignments
body: |
Lots more things are allowed on the left-hand side of a jq assignment
than in most langauges. We've already seen simple field accesses on
than in most languages. We've already seen simple field accesses on
the left hand side, and it's no surprise that array accesses work just
as well:
@@ -4,7 +4,7 @@ headline: jq 1.4 Manual
history: |
*The manual for the development version of jq can be found
[here](/jq/manual).*
[here](../).*
body: |
@@ -63,7 +63,7 @@ manpage_epilogue: |
Presumably. Report them or discuss them at:
https://github.com/stedolan/jq/issues
https://github.com/jqlang/jq/issues
## AUTHOR
@@ -76,8 +76,8 @@ sections:
jq filters run on a stream of JSON data. The input to jq is
parsed as a sequence of whitespace-separated JSON values which
are passed through the provided filter one at a time. The
output(s) of the filter are written to standard out, again as a
sequence of whitespace-separated JSON data.
output(s) of the filter are written to standard output, as a
sequence of newline-separated JSON data.
Note: it is important to mind the shell's quoting rules. As a
general rule it's best to always quote (with single-quote
@@ -93,34 +93,30 @@ sections:
You can affect how jq reads and writes its input and output
using some command-line options:
* `--version`:
* `--null-input` / `-n`:
Output the jq version and exit with zero.
Don't read any input at all. Instead, the filter is run once
using `null` as the input. This is useful when using jq as a
simple calculator or to construct JSON data from scratch.
* `--slurp`/`-s`:
Instead of running the filter for each JSON object in the
input, read the entire input stream into a large array and run
the filter just once.
* `--online-input`/`-I`:
When the top-level input value is an array produce its elements
instead of the array. This allows on-line processing of
potentially very large top-level arrays' elements.
* `--raw-input`/`-R`:
* `--raw-input` / `-R`:
Don't parse the input as JSON. Instead, each line of text is
passed to the filter as a string. If combined with `--slurp`,
then the entire input is passed to the filter as a single long
string.
* `--null-input`/`-n`:
* `--slurp` / `-s`:
Don't read any input at all! Instead, the filter is run once
using `null` as the input. This is useful when using jq as a
simple calculator or to construct JSON data from scratch.
Instead of running the filter for each JSON object in the
input, read the entire input stream into a large array and run
the filter just once.
* `--online-input` / `-I`:
When the top-level input value is an array produce its elements
instead of the array. This allows on-line processing of
potentially very large top-level arrays' elements.
* `--compact-output` / `-c`:
@@ -128,11 +124,12 @@ sections:
will result in more compact output by instead putting each
JSON object on a single line.
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
* `--raw-output` / `-r`:
By default, jq outputs colored JSON if writing to a
terminal. You can force it to produce color even if writing to
a pipe or a file using `-C`, and disable color with `-M`.
With this option, if the filter's result is a string then it
will be written directly to standard output rather than being
formatted as a JSON string with quotes. This can be useful for
making jq filters talk to non-JSON-based systems.
* `--ascii-output` / `-a`:
@@ -142,37 +139,27 @@ sections:
ASCII output with every non-ASCII character replaced with the
equivalent escape sequence.
* `--unbuffered`
* `--sort-keys` / `-S`:
Output the fields of each object with the keys in sorted order.
* `--color-output` / `-C` and `--monochrome-output` / `-M`:
By default, jq outputs colored JSON if writing to a
terminal. You can force it to produce color even if writing to
a pipe or a file using `-C`, and disable color with `-M`.
* `--unbuffered`:
Flush the output after each JSON object is printed (useful if
you're piping a slow data source into jq and piping jq's
output elsewhere).
* `--sort-keys` / `-S`:
Output the fields of each object with the keys in sorted order.
* `--raw-output` / `-r`:
With this option, if the filter's result is a string then it
will be written directly to standard output rather than being
formatted as a JSON string with quotes. This can be useful for
making jq filters talk to non-JSON-based systems.
* `-f filename` / `--from-file filename`:
Read filter from the file rather than from a command line, like
awk's -f option. You can also use '#' to make comments.
* `-e` / `--exit-status`:
Sets the exit status of jq to 0 if the last output values was
neither `false` nor `null`, 1 if the last output value was
either `false` or `null`, or 4 if no valid result was ever
produced. Normally jq exits with 2 if there was any usage
problem or system error, 3 if there was a jq program compile
error, or 0 if the jq program ran.
* `--arg name value`:
This option passes a value to the jq program as a predefined
@@ -187,6 +174,23 @@ sections:
program and has the value resulting from parsing the content of
the file named `bar`.
* `--exit-status` / `-e`:
Sets the exit status of jq to 0 if the last output value was
neither `false` nor `null`, 1 if the last output value was
either `false` or `null`, or 4 if no valid result was ever
produced. Normally jq exits with 2 if there was any usage
problem or system error, 3 if there was a jq program compile
error, or 0 if the jq program ran.
* `--version` / `-V`:
Output the jq version and exit with zero.
* `--help` / `-h`:
Output the jq help and exit with zero.
- title: Basic filters
entries:
- title: "`.`"
@@ -212,50 +216,49 @@ sections:
JSON object (aka dictionary or hash) as input, it produces
the value at the key "foo", or null if there's none present.
If the key contains special characters, you need to surround
it with double quotes like this: `."foo$"`.
If the key contains special characters or starts with a digit,
you need to surround it with double quotes like this: `."foo$"`.
A filter of the form `.foo.bar` is equivalent to `.foo|.bar`.
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
output: [42]
output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]'
input: '{"foo": 42}'
output: [42]
output: ['42']
- title: "`.foo?`"
body: |
Just like `.foo`, but does not output even an error when `.`
is not an array or an object.
Just like `.foo`, but does not output an error when `.` is not an
object.
examples:
- program: '.foo?'
input: '{"foo": 42, "bar": "less interesting data"}'
output: [42]
output: ['42']
- program: '.foo?'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]?'
input: '{"foo": 42}'
output: [42]
output: ['42']
- program: '[.foo?]'
input: '[1,2]'
output: ['[]']
- title: "`.[<string>]`, `.[2]`, `.[10:15]`"
- title: "`.[<string>]`, `.[<number>]`, `.[<number>:<number>]`"
body: |
You can also look up fields of an object using syntax like
`.["foo"]` (.foo above is a shorthand version of this). This
one works for arrays as well, if the key is an
integer. Arrays are zero-based (like javascript), so `.[2]`
returns the third element of the array.
`.["foo"]` (`.foo` above is a shorthand version of this). This
one works for arrays as well, if the key is an integer. Arrays
are zero-based, so `.[2]` returns the third element of the array.
The `.[10:15]` syntax can be used to return a subarray of an
array or substring of a string. The array returned by
@@ -263,7 +266,7 @@ sections:
index 10 (inclusive) to index 15 (exclusive). Either index may
be negative (in which case it counts backwards from the end of
the array), or omitted (in which case it refers to the start
or end of the array).
or end of the array). Indices are zero-based.
The `?` "operator" can also be used with the slice operator,
as in `.[10:15]?`, which outputs values where the inputs are
@@ -375,13 +378,13 @@ sections:
hashes with only string keys), and "null".
Booleans, null, strings and numbers are written the same way as
in javascript. Just like everything else in jq, these simple
in JSON. Just like everything else in jq, these simple
values take an input and produce an output - `42` is a valid jq
expression that takes an input, ignores it, and returns 42
instead.
entries:
- title: Array construction - `[]`
- title: "Array construction: `[]`"
body: |
As in JSON, `[]` is used to construct arrays, as in
@@ -406,7 +409,7 @@ sections:
- program: "[.user, .projects[]]"
input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}'
output: ['["stedolan", "jq", "wikiflow"]']
- title: Objects - `{}`
- title: "Objects: `{}`"
body: |
Like JSON, `{}` is for constructing objects (aka
@@ -467,14 +470,14 @@ sections:
- title: Builtin operators and functions
body: |
Some jq operator (for instance, `+`) do different things
Some jq operators (for instance, `+`) do different things
depending on the type of their arguments (arrays, numbers,
etc.). However, jq never does implicit type conversions. If you
try to add a string to an object you'll get an error message and
no result.
entries:
- title: Addition - `+`
- title: "Addition: `+`"
body: |
The operator `+` takes two filters, applies them both
@@ -513,11 +516,11 @@ sections:
input: 'null'
output: ['{"a": 42, "b": 2, "c": 3}']
- title: Subtraction - `-`
- title: "Subtraction: `-`"
body: |
As well as normal arithmetic subtraction on numbers, the `-`
operator can be used on arrays to remove all occurences of
operator can be used on arrays to remove all occurrences of
the second array's elements from the first array.
examples:
@@ -528,7 +531,7 @@ sections:
input: '["xml", "yaml", "json"]'
output: ['["json"]']
- title: Multiplication, division, modulo - `*`, `/`, and `%`
- title: "Multiplication, division, modulo: `*`, `/`, `%`"
body: |
These operators only work on numbers, and do the expected.
@@ -546,8 +549,8 @@ sections:
examples:
- program: '10 / . * 3'
input: 5
output: [6]
input: '5'
output: ['6']
- program: '. / ", "'
input: '"a, b,c,d, e"'
output: ['["a","b,c,d","e"]']
@@ -574,7 +577,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null]'
output: [2, 6, 1, 0]
output: ['2', '6', '1', '0']
- title: "`keys`"
body: |
@@ -632,7 +635,7 @@ sections:
input: '["foo", "bar", "baz"]'
output: ['["foo"]']
- title: "`to_entries`, `from_entries`, `with_entries`"
- title: "`to_entries`, `from_entries`, `with_entries(f)`"
body: |
These functions convert between an object and an array of
@@ -641,9 +644,9 @@ sections:
includes `{"key": k, "value": v}`.
`from_entries` does the opposite conversion, and
`with_entries(foo)` is a shorthand for `to_entries |
map(foo) | from_entries`, useful for doing some operation to
all keys and values of an object.
`with_entries(f)` is a shorthand for `to_entries | map(f) |
from_entries`, useful for doing some operation to all keys
and values of an object.
examples:
- program: 'to_entries'
@@ -695,19 +698,19 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
output: [1, 2]
output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
- title: "`map(x)`"
- title: "`map(f)`"
body: |
For any filter `x`, `map(x)` will run that filter for each
For any filter `f`, `map(f)` will run that filter for each
element of the input array, and produce the outputs a new
array. `map(.+1)` will increment each element of an array of numbers.
`map(x)` is equivalent to `[.[] | x]`. In fact, this is how
`map(f)` is equivalent to `[.[] | f]`. In fact, this is how
it's defined.
examples:
@@ -758,7 +761,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
output: [6]
output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -849,7 +852,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
output: [1, 1]
output: ['1', '1']
- title: "`tostring`"
body: |
@@ -875,7 +878,7 @@ sections:
input: '[0, false, [], {}, null, "hello"]'
output: ['["number", "boolean", "array", "object", "null", "string"]']
- title: "`sort, sort_by`"
- title: "`sort`, `sort_by`"
body: |
The `sort` functions sorts its input, which must be an
@@ -957,7 +960,7 @@ sections:
The `unique_by(.foo)` function takes as input an array and produces
an array of the same elements, in sorted order, with
elqements with a duplicate `.foo` field removed. Think of it as making
elements with a duplicate `.foo` field removed. Think of it as making
an array by taking one element out of every group produced by
`group_by`.
@@ -1179,7 +1182,7 @@ sections:
input: '[[{"a":1}]]'
output: ['1']
- title: "String interpolation - `\\(foo)`"
- title: "String interpolation: `\\(exp)`"
body: |
Inside a string, you can put an expression inside parens
@@ -1274,10 +1277,6 @@ sections:
input: '"This works if x < y"'
output: ['"This works if x &lt; y"']
# - program: '@html "<span>Anonymous said: \(.)</span>"'
# input: '"<script>alert(\"lol hax\");</script>"'
# output: ["<span>Anonymous said: &lt;script&gt;alert(&quot;lol hax&quot;);&lt;/script&gt;</span>"]
- program: '@sh "echo \(.)"'
input: "\"O'Hara's Ale\""
output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""]
@@ -1290,8 +1289,8 @@ sections:
The expression 'a == b' will produce 'true' if the result of a and b
are equal (that is, if they represent equivalent JSON documents) and
'false' otherwise. In particular, strings are never considered equal
to numbers. If you're coming from Javascript, jq's == is like
Javascript's === - considering values equal only when they have the
to numbers. If you're coming from JavaScript, jq's == is like
JavaScript's === - considering values equal only when they have the
same type as well as the same value.
!= is "not equal", and 'a != b' returns the opposite value of 'a == b'
@@ -1300,7 +1299,8 @@ sections:
- program: '.[] == 1'
input: '[1, 1.0, "1", "banana"]'
output: ['true', 'true', 'false', 'false']
- title: if-then-else
- title: if-then-else-end
body: |
`if A then B else C end` will act the same as `B` if `A`
@@ -1308,7 +1308,7 @@ sections:
as `C` otherwise.
Checking for false or null is a simpler notion of
"truthiness" than is found in Javascript or Python, but it
"truthiness" than is found in JavaScript or Python, but it
means that you'll sometimes have to be more explicit about
the condition you want: you can't test whether, e.g. a
string is empty using `if .name then A else B end`, you'll
@@ -1330,10 +1330,10 @@ sections:
else
"many"
end
input: 2
input: '2'
output: ['"many"']
- title: "`>, >=, <=, <`"
- title: "`>`, `>=`, `<=`, `<`"
body: |
The comparison operators `>`, `>=`, `<=`, `<` return whether
@@ -1345,15 +1345,16 @@ sections:
examples:
- program: '. < 5'
input: 2
input: '2'
output: ['true']
- title: and/or/not
- title: "`and`, `or`, `not`"
body: |
jq supports the normal Boolean operators and/or/not. They have the
same standard of truth as if expressions - false and null are
considered "false values", and anything else is a "true value".
jq supports the normal Boolean operators `and`, `or`, `not`.
They have the same standard of truth as if expressions -
`false` and `null` are considered "false values", and
anything else is a "true value".
If an operand of one of these operators produces multiple
results, the operator itself will produce a result for each input.
@@ -1363,12 +1364,12 @@ sections:
rather than with special syntax, as in `.foo and .bar |
not`.
These three only produce the values "true" and "false", and
These three only produce the values `true` and `false`, and
so are only useful for genuine Boolean operations, rather
than the common Perl/Python/Ruby idiom of
"value_that_may_be_null or default". If you want to use this
form of "or", picking between two values rather than
evaluating a condition, see the "//" operator below.
evaluating a condition, see the `//` operator below.
examples:
- program: '42 and "a string"'
@@ -1377,9 +1378,6 @@ sections:
- program: '(true, false) or false'
input: 'null'
output: ['true', 'false']
# - program: '(true, false) and (true, false)'
# input: 'null'
# output: ['true', 'false', 'false', 'false']
- program: '(true, true) and (true, false)'
input: 'null'
output: ['true', 'false', 'true', 'false']
@@ -1387,7 +1385,7 @@ sections:
input: 'null'
output: ['[false, true]']
- title: Alternative operator - `//`
- title: "Alternative operator: `//`"
body: |
A filter of the form `a // b` produces the same
@@ -1403,10 +1401,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
output: [19]
output: ['19']
- program: '.foo // 42'
input: '{}'
output: [42]
output: ['42']
- title: Advanced features
body: |
@@ -1422,7 +1420,7 @@ sections:
It is also possible to define functions in jq, although this is
is a feature whose biggest use is defining jq's standard library
(many jq functions such as `map` and `find` are in fact written
(many jq functions such as `map` and `select` are in fact written
in jq).
Finally, jq has a `reduce` operation, which is very powerful but a
@@ -1463,7 +1461,7 @@ sections:
fields, and another object which is used to map author usernames to
real names. Our input looks like:
{"posts": [{"title": "Frist psot", "author": "anon"},
{"posts": [{"title": "First post", "author": "anon"},
{"title": "A well-written article", "author": "person1"}],
"realnames": {"anon": "Anonymous Coward",
"person1": "Person McPherson"}}
@@ -1471,7 +1469,7 @@ sections:
We want to produce the posts with the author field containing a real
name, as in:
{"title": "Frist psot", "author": "Anonymous Coward"}
{"title": "First post", "author": "Anonymous Coward"}
{"title": "A well-written article", "author": "Person McPherson"}
We use a variable, $names, to store the realnames object, so that we
@@ -1535,29 +1533,29 @@ sections:
input: '[[1,2],[10,20]]'
output: ['[[1,2,1,2], [10,20,1,2]]']
- title: Reduce
- title: "`reduce`"
body: |
The `reduce` syntax in jq allows you to combine all of the
results of an expression by accumulating them into a single
answer. As an example, we'll pass `[3,2,1]` to this expression:
The `reduce` syntax allows you to combine all of the results of
an expression by accumulating them into a single answer.
The form is `reduce EXP as $var (INIT; UPDATE)`.
As an example, we'll pass `[1,2,3]` to this expression:
reduce .[] as $item (0; . + $item)
For each result that `.[]` produces, `. + $item` is run to
accumulate a running total, starting from 0. In this
example, `.[]` produces the results 3, 2, and 1, so the
effect is similar to running something like this:
accumulate a running total, starting from 0 as the input value.
In this example, `.[]` produces the results `1`, `2`, and `3`,
so the effect is similar to running something like this:
0 | (3 as $item | . + $item) |
(2 as $item | . + $item) |
(1 as $item | . + $item)
0 | 1 as $item | . + $item |
2 as $item | . + $item |
3 as $item | . + $item
examples:
- program: 'reduce .[] as $item (0; . + $item)'
input: '[10,2,5,3]'
output: ['20']
input: '[1,2,3,4,5]'
output: ['15']
- title: Assignment
body: |
@@ -1571,7 +1569,7 @@ sections:
If an object has two fields which are arrays, `.foo` and `.bar`,
and you append something to `.foo`, then `.bar` will not get
bigger. Even if you've just set `.bar = .foo`. If you're used to
programming in languages like Python, Java, Ruby, Javascript,
programming in languages like Python, Java, Ruby, JavaScript,
etc. then you can think of it as though jq does a full deep copy
of every object before it does the assignment (for performance,
it doesn't actually do that, but that's the general idea).
@@ -1588,7 +1586,7 @@ sections:
.foo = .bar | .foo.baz = 1
will not have the side-effect of setting .bar.baz to be set
to 1, as the similar-looking program in Javascript, Python,
to 1, as the similar-looking program in JavaScript, Python,
Ruby or other languages would. Unlike these languages (but
like Haskell and some other functional languages), there is
no notion of two arrays or objects being "the same array" or
@@ -1634,7 +1632,7 @@ sections:
- title: Complex assignments
body: |
Lots more things are allowed on the left-hand side of a jq assignment
than in most langauges. We've already seen simple field accesses on
than in most languages. We've already seen simple field accesses on
the left hand side, and it's no surprise that array accesses work just
as well:
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+337
View File
@@ -0,0 +1,337 @@
headline: Tutorial
body:
- text: |
GitHub has a JSON API, so let's play with that. This URL gets us the last
5 commits from the jq repo.
- command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5'"
result: |
[
{
"sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg",
"commit": {
"author": {
"name": "Mattias Wadman",
"email": "mattias.wadman@gmail.com",
"date": "2021-06-09T14:02:22Z"
},
"committer": {
"name": "Nico Williams",
"email": "nico@cryptonector.com",
"date": "2022-05-26T21:04:32Z"
},
"message": "docs: Document repeat(exp)",
"tree": {
"sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b",
"url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b"
},
"url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments",
"author": {
...
- text: |
GitHub returns nicely formatted JSON. For servers that don't, it can be
helpful to pipe the response through jq to pretty-print it. The simplest
jq program is the expression `.`, which takes the input and produces it
unchanged as output.
- command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.'"
result: |
[
{
"sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg",
"commit": {
"author": {
"name": "Mattias Wadman",
"email": "mattias.wadman@gmail.com",
"date": "2021-06-09T14:02:22Z"
},
"committer": {
"name": "Nico Williams",
"email": "nico@cryptonector.com",
"date": "2022-05-26T21:04:32Z"
},
"message": "docs: Document repeat(exp)",
"tree": {
"sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b",
"url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b"
},
"url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments",
"author": {
...
- text: |
We can use jq to extract just the first commit.
- command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.[0]'"
result: |
{
"sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg",
"commit": {
"author": {
"name": "Mattias Wadman",
"email": "mattias.wadman@gmail.com",
"date": "2021-06-09T14:02:22Z"
},
"committer": {
"name": "Nico Williams",
"email": "nico@cryptonector.com",
"date": "2022-05-26T21:04:32Z"
},
"message": "docs: Document repeat(exp)",
"tree": {
"sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b",
"url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b"
},
"url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8",
"comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments",
"author": {
"login": "wader",
"id": 185566,
"node_id": "MDQ6VXNlcjE4NTU2Ng==",
"avatar_url": "https://avatars.githubusercontent.com/u/185566?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/wader",
"html_url": "https://github.com/wader",
"followers_url": "https://api.github.com/users/wader/followers",
"following_url": "https://api.github.com/users/wader/following{/other_user}",
"gists_url": "https://api.github.com/users/wader/gists{/gist_id}",
"starred_url": "https://api.github.com/users/wader/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/wader/subscriptions",
"organizations_url": "https://api.github.com/users/wader/orgs",
"repos_url": "https://api.github.com/users/wader/repos",
"events_url": "https://api.github.com/users/wader/events{/privacy}",
"received_events_url": "https://api.github.com/users/wader/received_events",
"type": "User",
"site_admin": false
},
"committer": {
"login": "nicowilliams",
"id": 604851,
"node_id": "MDQ6VXNlcjYwNDg1MQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/604851?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/nicowilliams",
"html_url": "https://github.com/nicowilliams",
"followers_url": "https://api.github.com/users/nicowilliams/followers",
"following_url": "https://api.github.com/users/nicowilliams/following{/other_user}",
"gists_url": "https://api.github.com/users/nicowilliams/gists{/gist_id}",
"starred_url": "https://api.github.com/users/nicowilliams/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/nicowilliams/subscriptions",
"organizations_url": "https://api.github.com/users/nicowilliams/orgs",
"repos_url": "https://api.github.com/users/nicowilliams/repos",
"events_url": "https://api.github.com/users/nicowilliams/events{/privacy}",
"received_events_url": "https://api.github.com/users/nicowilliams/received_events",
"type": "User",
"site_admin": false
},
"parents": [
{
"sha": "f2ad9517c72f6267ae317639ab56bbfd4a8653d4",
"url": "https://api.github.com/repos/jqlang/jq/commits/f2ad9517c72f6267ae317639ab56bbfd4a8653d4",
"html_url": "https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4"
}
]
}
- text: |
For the rest of the examples, I'll leave out the `curl` command - it's not
going to change.
There's a lot of info we don't care about there, so we'll restrict it down
to the most interesting fields.
- command: "jq '.[0] | {message: .commit.message, name: .commit.committer.name}'"
result: |
{
"message": "docs: Document repeat(exp)",
"name": "Nico Williams"
}
- text: |
The `|` operator in jq feeds the output of one filter (`.[0]` which gets
the first element of the array in the response) into the input of another
(`{...}` which builds an object out of those fields). You can access
nested attributes, such as `.commit.message`.
Now let's get the rest of the commits.
- command: "jq '.[] | {message: .commit.message, name: .commit.committer.name}'"
result: |
{
"message": "docs: Document repeat(exp)",
"name": "Nico Williams"
}
{
"message": "Mention -n in IO-section and for input/inputs",
"name": "Nico Williams"
}
{
"message": "Fix iterration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happend because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.",
"name": "Nico Williams"
}
{
"message": "docs: point to Libera.Chat instead of Freenode",
"name": "Nico Williams"
}
{
"message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.",
"name": "Nico Williams"
}
- text: |
`.[]` returns each element of the array returned in the response, one at a
time, which are all fed into
`{message: .commit.message, name: .commit.committer.name}`.
Data in jq is represented as streams of JSON values - every jq
expression runs for each value in its input stream, and can
produce any number of values to its output stream.
Streams are serialised by just separating JSON values with
whitespace. This is a `cat`-friendly format - you can just join
two JSON streams together and get a valid JSON stream.
If you want to get the output as a single array, you can tell jq to
"collect" all of the answers by wrapping the filter in square
brackets:
- command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name}]'"
result: |
[
{
"message": "docs: Document repeat(exp)",
"name": "Nico Williams"
},
{
"message": "Mention -n in IO-section and for input/inputs",
"name": "Nico Williams"
},
{
"message": "Fix iterration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happend because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.",
"name": "Nico Williams"
},
{
"message": "docs: point to Libera.Chat instead of Freenode",
"name": "Nico Williams"
},
{
"message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.",
"name": "Nico Williams"
}
]
- text: |
- - -
Next, let's try getting the URLs of the parent commits out of the
API results as well. In each commit, the GitHub API includes information
about "parent" commits. There can be one or many.
"parents": [
{
"sha": "f2ad9517c72f6267ae317639ab56bbfd4a8653d4",
"url": "https://api.github.com/repos/jqlang/jq/commits/f2ad9517c72f6267ae317639ab56bbfd4a8653d4",
"html_url": "https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4"
}
]
We want to pull out all of the "html_url" fields inside that array of parent
commits and make a simple list of strings to go along with the
"message" and "author" fields we already have.
- command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name, parents: [.parents[].html_url]}]'"
result: |
[
{
"message": "docs: Document repeat(exp)",
"name": "Nico Williams",
"parents": [
"https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4"
]
},
{
"message": "Mention -n in IO-section and for input/inputs",
"name": "Nico Williams",
"parents": [
"https://github.com/jqlang/jq/commit/c4d39c4d22f2b12225ca1b311708f7e084ad9ff8"
]
},
{
"message": "Fix iterration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happend because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.",
"name": "Nico Williams",
"parents": [
"https://github.com/jqlang/jq/commit/174db0f93552bdb551ae1f3c5c64744df0ad8e2f"
]
},
{
"message": "docs: point to Libera.Chat instead of Freenode",
"name": "Nico Williams",
"parents": [
"https://github.com/jqlang/jq/commit/29cf77977ef52eec708982b19bf9d2ec17443337"
]
},
{
"message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.",
"name": "Nico Williams",
"parents": [
"https://github.com/jqlang/jq/commit/55e6e2c21829bd866bd4b18ee254b05c9020320a"
]
}
]
- text: |
Here we're making an object as before, but this time the `parents`
field is being set to `[.parents[].html_url]`, which collects
all of the parent commit URLs defined in the parents object.
- text: |
- - -
Here endeth the tutorial! There's lots more to play with. Go
read [the manual](../manual/) if you're interested, and [download
jq](../download/) if you haven't already.
+63
View File
@@ -0,0 +1,63 @@
type: object
required:
- headline
- history
- body
- manpage_intro
- manpage_epilogue
- sections
additionalProperties: false
properties:
headline:
type: string
history:
type: string
body:
type: string
manpage_intro:
type: string
manpage_epilogue:
type: string
sections:
type: array
items:
type: object
required:
- title
additionalProperties: false
properties:
title:
type: string
body:
type: string
entries:
type: array
items:
type: object
required:
- title
- body
additionalProperties: false
properties:
title:
type: string
body:
type: string
examples:
type: array
items:
type: object
required:
- program
- input
- output
additionalProperties: false
properties:
program:
type: string
input:
type: string
output:
type: array
items:
type: string
-181
View File
@@ -1,181 +0,0 @@
@charset "utf-8";
body {
padding-top: 80px;
}
.container {
max-width: 970px;
}
/* index.liquid *******************************************/
#blurb {
padding-top: 40px;
p {
font-size: 1.9em;
}
.btn-group {
margin: 4px;
}
}
#multiblurb {
line-height: 1.7;
text-align: center;
font-size: 12pt;
code {
border: 0;
font-size: 12pt;
}
}
#news {
font-size: 12pt;
.date {
font-style: italic;
}
}
/* default.liquid *****************************************/
.tutorial-example {
position: relative;
margin-bottom: 10px;
pre {
margin-bottom: 0px;
}
a {
position: absolute;
top: 0px;
right: 0px;
padding: 15px 8px;
color: #777777;
font-weight: bold;
line-height: 10px;
font-size: 12px;
border-left: 1px solid #DDDDDD;
display: block;
}
.accordion-body pre {
margin: 0 4px;
border-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}
@media print {
.tutorial-example a {
display: none;
}
}
/* manual.liquid ******************************************/
section {
padding-top: 24px;
}
h3 code {
border: 0;
font-size: 20px;
}
@media(max-width: 991px){
#navcolumn {
/* Put nav column above manual content */
position: relative !important;
margin-bottom: 60px;
}
}
@media(min-width: 992px) {
#manualcontent {
/* Put nav column left of manual content */
padding-left: 280px;
}
}
.nav-pills {
li a {
padding: 8px 12px;
}
margin-bottom: 20px;
}
.manual-example table {
border-top: 1px solid #E5E5E5;
td {
white-space: pre-wrap;
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
}
td.jqprogram {
font-weight: bold;
}
th {
text-align: right;
padding-right: 10px;
}
}
@media print {
#navcolumn {
display: none !important;
}
.manual-example {
display: block !important;
height: auto !important;
}
.jqplay-btn {
display: none !important;
}
}
/* shared/_footer.liquid **********************************/
footer {
background-color: #F5F5F5;
padding: 20px 0;
margin-top: 40px;
color: #999999;
text-align: center;
p {
margin: 8px 0;
}
}
/* typeahead **********************************************/
.twitter-typeahead {
width: 100%;
}
.tt-menu {
width: 100%;
background-color: #fff;
padding: 8px 0;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
}
.tt-suggestion {
padding: 3px 20px;
&:hover {
cursor: pointer;
color: #fff;
background-color: #446e9b;
}
&.tt-cursor {
color: #fff;
background-color: #446e9b;
}
p {
margin: 0;
}
}
+99
View File
@@ -0,0 +1,99 @@
main {
padding: 1rem;
& * {
scroll-margin-top: 4rem;
}
@media print {
width: 100%!important;
--bs-code-color: --bs-body-color;
}
}
header {
z-index: 1050!important; /* higher than #contents */
}
section[id] {
display: flow-root;
> :first-child {
.icon-link {
opacity: 0;
&:focus {
opacity: .8;
}
}
&:hover .icon-link {
opacity: 1;
}
}
}
.offcanvas[aria-modal=true] .nav-link {
padding: .7rem;
}
.offcanvas-md {
--bs-offcanvas-width: auto;
}
ul {
list-style: none;
padding-left: 1rem;
}
pre {
margin: 0 .5rem 1rem;
padding: .5rem 1rem;
background-color: var(--bs-secondary-bg-subtle);
border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
}
button{
&[aria-expanded=false] .bi-chevron-down {
display: none;
}
&[aria-expanded=true] .bi-chevron-right {
display: none;
}
}
mark {
padding: 0;
}
.container-searchbox {
position: relative;
& input:focus ~ kbd {
display: none;
}
& ul {
position: absolute;
width: 100%;
top: 100%;
padding: 0;
background-color: var(--bs-body-bg);
border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
}
& li {
padding: .3em .6em;
white-space: nowrap;
overflow-x: hidden;
&[aria-selected=true] {
background-color: var(--bs-secondary-bg);
}
&:hover {
cursor: pointer;
background-color: var(--bs-secondary-bg-subtle);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

+1
View File
@@ -0,0 +1 @@
<svg width="48" height="48" version="1.0" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg"><style>@media(prefers-color-scheme:dark){g[fill]{filter:invert(1)}}</style><g transform="matrix(.011 0 0 .011 1.94 12)"><g fill="#444"><circle cx="220" cy="1570" r="190"/><path d="m1330 312c-30 41-698 1492-710 1528s25 66 100 101c77 36 102 34 124 3s701-1477 716-1525c15-47-20-73-84-104s-116-44-146-3z"/></g><g fill="#111"><circle cx="2410" cy="200" r="190"/><path d="m1830 655c0 129 0 130 70 130h360v423c0 246-5 474-10 506-19 112-88 176-190 176-59 0-120-27-147-66-51-73-65-84-99-84-31 0-40 8-104 93-84 111-86 129-32 189 227 252 692 187 836-118 53-112 56-153 56-795v-514c0-64-30-100-100-100h-490c-149 0-150 0-150 160zM2867 1233c30 302 250 499 438 527 144 19 244 0 375-90v410c0 81 0 100 150 100 136 0 150-20 150-150v-1420c0-99-19-100-150-100s-139 15-139 82c-103-89-351-149-523-49s-342 278-301 690zm803-107c0 292-105 356-237 356-178 0-249-147-273-296-27-168 25-420 262-420 171 0 248 89 248 360z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg width="400" height="220" version="1.0" viewBox="0 0 400 220" xmlns="http://www.w3.org/2000/svg"><style>@media (prefers-color-scheme:dark){g[fill]{filter:invert(1);stroke:none}}</style><g transform="scale(.1)" stroke="#fff" stroke-width="10"><g fill="#444"><circle cx="220" cy="1570" r="190"/><path d="m1330 312c-30 41-698 1492-710 1528s25 66 100 101c77 36 102 34 124 3s701-1477 716-1525c15-47-20-73-84-104s-116-44-146-3z"/></g><g fill="#111"><circle cx="2410" cy="200" r="190"/><path d="m1830 655c0 129 0 130 70 130h360v423c0 246-5 474-10 506-19 112-88 176-190 176-59 0-120-27-147-66-51-73-65-84-99-84-31 0-40 8-104 93-84 111-86 129-32 189 227 252 692 187 836-118 53-112 56-153 56-795v-514c0-64-30-100-100-100h-490c-149 0-150 0-150 160zM2867 1233c30 302 250 499 438 527 144 19 244 0 375-90v410c0 81 0 100 150 100 136 0 150-20 150-150v-1420c0-99-19-100-150-100s-139 15-139 82c-103-89-351-149-523-49s-342 278-301 690zm803-107c0 292-105 356-237 356-178 0-249-147-273-296-27-168 25-420 262-420 171 0 248 89 248 360z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+32 -50
View File
@@ -1,52 +1,34 @@
var section_names = function(q) {
if (!q) {
return [];
}
var matches = [];
q = q.toLowerCase();
$.each(section_map, function(k, v) {
if (k.toLowerCase().indexOf(q) != -1) {
matches.push(k);
(() => {
const searchInput = document.querySelector('input#searchbox');
const sectionIDs = JSON.parse(document.querySelector('#section-ids').innerText);
const sanitize = (string) => string.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
new autoComplete({
selector: `#${searchInput.id}`,
wrapper: false,
data: {
src: Object.keys(sectionIDs),
filter: (list) => list.sort((x, y) =>
x.match.indexOf('<') - y.match.indexOf('<') || x.value.length - y.value.length),
},
searchEngine: (query, value) => {
const index = value.toLowerCase().indexOf(query.toLowerCase());
if (index >= 0) {
return sanitize(value.substring(0, index)) +
`<mark>${sanitize(value.substring(index, index + query.length))}</mark>` +
sanitize(value.substring(index + query.length));
}
},
});
searchInput.addEventListener('selection', (event) => {
event.target.value = event.detail.selection.value;
location.hash = `#${sectionIDs[event.detail.selection.value]}`;
});
document.addEventListener('keydown', (event) => {
if (event.code === 'Slash' && !event.altKey && !event.ctrlKey && !event.metaKey
&& !event.shiftKey && !/^(INPUT|TEXTAREA)$/.test(event.target.nodeName)) {
searchInput.focus();
searchInput.select();
event.preventDefault();
}
});
matches.sort(function(a, b) {
// shortest to longest
return a.length - b.length;
});
return matches;
}
var section_names_cb = function(q, cb) {
cb(section_names(q));
}
var go_to_section = function() {
query = $('#searchbox').val();
results = section_names(query);
if (results.length == 0) {
return;
}
result = results[0];
location.hash = '#' + section_map[result];
if (result != query) {
$('#searchbox').val(result);
}
}
$(function(){
$('#searchbox').typeahead(
{hint: false, highlight: true, minLength: 1},
{name: "contents", source: section_names_cb, limit: 6}
).on('typeahead:selected', function(e, data) {
go_to_section();
});
$('#searchbox').change(go_to_section);
});
// add "Run" button to execute examples on jqplay.org
$(function() {
$.each($('.manual-example table'), function(index, value) {
$value = $(value)
var j = $value.find('tr:nth-child(2) td:first').text();
var q = $value.find('.jqprogram').text().replace(/^jq /, '').replace(/(\r\n|\n|\r)/gm," ").replace(/^'(.+)'$/, '$1');
var url = 'https://jqplay.org/jq?q=' + encodeURIComponent(q) +'&j=' + encodeURIComponent(j)
var $last_tr = $value.find('tr:last');
$last_tr.after('<tr class="jqplay-btn"><th><a href="' + url + '" class="btn btn-primary btn-sm">Run</a></th><th></th></tr><tr><th></th><th></th></tr>');
});
});
})();
-9
View File
@@ -1,9 +0,0 @@
# The key value pairs found below are available within the templates.
:url: https://stedolan.github.io/jq
# This line is modified by the Makefile. To change the version number,
# edit the Autoconf version number at the top of configure.ac
jq_version: "1.4-2-g15c4a7f-dirty"
root: '/jq'
+31
View File
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/_head.html.j2" %}
<body>
{% include "shared/_navbar.html.j2" %}
<main id="main" class="container-lg">
<h1>{{ headline }}</h1>
{%- for item in body %}
{%- if item.text %}
{{ item.text | markdownify }}
{%- endif %}
{%- if item.command %}
{%- set resultID = unique_id() %}
<div class="tutorial-example mb-3">
<div class="d-flex accordion-heading me-2">
<pre class="flex-grow-1 me-0 mb-0" tabindex="0">{{ item.command }}</pre>
<button type="button" class="btn btn-sm btn-secondary text-body-secondary bg-secondary-subtle link-body-emphasis flex-shrink-0 d-flex align-items-center border border-start-0 d-print-none"
data-bs-toggle="collapse" data-bs-target="#result{{ resultID }}" aria-expanded="false" aria-controls="result{{ resultID }}">Show result</button>
</div>
<pre id="result{{ resultID }}" class="accordion-body collapse p-3 border-top-0 d-print-block" tabindex="0">{{ item.result }}</pre>
</div>
{%- endif %}
{%- endfor %}
</main>
{% include "shared/_footer.html.j2" %}
</body>
</html>
-34
View File
@@ -1,34 +0,0 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/head" %}
<body id="{{slug}}">
{% include "shared/navbar" %}
<div class="container">
<div class="row">
<h1>{{headline}}</h1>
{% for item in body %}
{% if item.text %}
{{ item.text | replace: '$JQ_VERSION', jq_version | markdownify }}
{% endif %}
{% if item.command %}
{% capture resultID %}{{ "result" | unique}}{% endcapture %}
<div class="tutorial-example">
<div class="accordion-heading">
<pre>{{item.command}}</pre>
<a data-toggle="collapse" href="#{{resultID}}">Show result</a>
</div>
<div id="{{resultID}}" class="accordion-body collapse">
<pre>{{item.result}}</pre>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% include "shared/footer" %}
</body>
</html>
+56
View File
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/_head.html.j2" %}
<body>
{% include "shared/_navbar.html.j2" %}
<main id="main" class="container-lg">
<div class="row">
<div class="col-md-6 text-center p-3">
<h1><img src="{{ root }}/jq.svg" class="img-fluid" alt="jq" width="400" height="220"></h1>
</div>
<div class="col-md-6 d-flex flex-column justify-content-center text-center align-items-center">
<h2 class="px-1" style="width:16em">{{ blurb }}</h2>
<div class="btn-group d-print-none" role="group">
<button type="button" class="btn btn-primary dropdown-toggle text-nowrap" data-bs-toggle="dropdown" aria-expanded="false">
Download jq 1.6
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64" aria-label="Link to download executable: Linux (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Linux (64-bit)</a></li>
<li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64" aria-label="Link to download executable: macOS (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (64-bit)</a></li>
<li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe" aria-label="Link to download executable: Windows (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Windows (64-bit)</a></li>
<li><a class="dropdown-item" href="{{ root }}/download/">Other platforms, older versions, and source</a></li>
</ul>
<a class="btn btn-primary text-nowrap" href="https://jqplay.org" target="_blank" rel="noopener">
Try online at jqplay.org!<span class="bi bi-box-arrow-up-right ms-1" aria-hidden="true"></span>
</a>
</div>
</div>
</div>
<div class="row my-3">
<div class="col-md-4">{{ body1 | markdownify }}</div>
<div class="col-md-4">{{ body2 | markdownify }}</div>
<div class="col-md-4">{{ body3 | markdownify }}</div>
</div>
<div class="text-center my-3">
{{ tail | markdownify }}
</div>
<h2>News</h2>
<ul>
{%- for item in news %}
<li>
<span class="fst-italic">{{ item.date }}</span>
{{ item.body | markdownify }}
</li>
{%- endfor %}
</ul>
</main>
{% include "shared/_footer.html.j2" %}
</body>
</html>
-73
View File
@@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/head" %}
<body id="{{slug}}">
{% include "shared/navbar" %}
<div class="container">
<div class="row">
<div class="jumbotron">
<div class="row">
<div class="col-sm-6">
<img src="{{root}}/jq.png" class="img-responsive" alt="jq logo"
width="400" height="220">
</div>
<div class="col-sm-6">
<div id="blurb">
{{blurb | markdownify}}
<div class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group">
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">
Download jq 1.6
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64">Linux (64-bit)</a></li>
<li><a href="https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64">OS X (64-bit)</a></li>
<li><a href="https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe">Windows (64-bit)</a></li>
<li><a href="/jq/download/">Other platforms, older versions, and source</a></li>
</ul>
</div>
<div class="btn-group">
<a class="btn btn-primary" href="https://jqplay.org">
Try online at jqplay.org!
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="multiblurb">
<div class="col-sm-4">{{body1 | markdownify}}</div>
<div class="col-sm-4">{{body2 | markdownify}}</div>
<div class="col-sm-4">{{body3 | markdownify}}</div>
</div>
<div class="row" style="text-align:center; margin-top: 30px">
{{tail | markdownify}}
</div>
<div class="row">
<h2>News</h2>
<div id="news">
<ul>
{% for item in news %}
<li>
<span class="date">{{item.date}}</span>
{{item.body | markdownify}}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% include "shared/footer" %}
</body>
</html>
+110
View File
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/_head.html.j2" %}
<body>
{% include "shared/_navbar.html.j2" %}
<div class="container-lg row align-items-start mx-auto p-3">
<button type="button" class="d-md-none w-auto position-fixed bottom-0 end-0 p-2 m-3 bg-body-secondary border-0 text-body d-print-none"
data-bs-toggle="offcanvas" data-bs-target="#contents" aria-controls="contents" aria-expanded="false" aria-label="Toggle table of contents">
<span class="bi bi-list" aria-hidden="true"></span>
</button>
<nav id="contents" class="col-md-3 sticky-md-top p-3 overflow-y-auto offcanvas-md offcanvas-end d-print-none" style="top:4.5rem; height:calc(100dvh - 5.5rem);" aria-label="Table of contents">
<div class="d-flex justify-content-between">
<h4>Contents</h4>
<button type="button" class="btn-close d-md-none" data-bs-dismiss="offcanvas" data-bs-target="#contents" aria-label="Close table of contents"></button>
</div>
<ul class="offcanvas-md-body nav nav-pills flex-column">
{%- for section in sections %}
<li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
<a class="nav-link" href="#{{ section.title | section_id }}">{{ section.title }}</a>
</li>
{%- endfor %}
</ul>
</nav>
{%- set section_ids = {} %}
{%- macro check_section_id(id) -%}
{%- if section_ids.__contains__(id) %}
{{- raise('Duplicate section id: ' ~ id) }}
{%- endif %}
{%- set _ = section_ids.__setitem__(id, true) %}
{%- endmacro %}
<main id="main" class="col-md-9" data-bs-spy="scroll" data-bs-target="#contents" data-bs-threshold="0,1" data-bs-root-margin="-30% 0% -70%">
<h1>{{ headline }}</h1>
{{ history | markdownify }}
{{ body | markdownify }}
{%- for section in sections %}
<section id="{{ section.title | section_id }}">{{ check_section_id(section.title | section_id) }}
<h2>{{ section.title }} <a href="#{{ section.title | section_id }}" class="icon-link" aria-label="Link to this section: {{ section.title }}"><span class="bi bi-link-45deg" aria-hidden="true"></span></a></h2>
{{ section.body | markdownify if section.body }}
{%- for entry in section.entries %}
<section id="{{ entry.title | entry_id }}">{{ check_section_id(entry.title | entry_id) }}
<h3>
{{ entry.title | markdownify | no_paragraph }}
<a href="#{{ entry.title | entry_id }}" class="icon-link" aria-label="Link to this section: {{ entry.title }}"><span class="bi bi-link-45deg" aria-hidden="true"></span></a>
</h3>
{{ entry.body | markdownify }}
{%- if entry.examples %}
<div class="pb-3">
{%- set exampleID = unique_id() %}
<button type="button" class="btn btn-sm btn-secondary text-body-secondary bg-transparent link-body-emphasis border-0" data-bs-toggle="collapse" data-bs-target="#example{{ exampleID }}" aria-expanded="false" aria-controls="example{{ exampleID }}">
<span class="me-1 d-print-none" aria-hidden="true"><span class="bi bi-chevron-right"></span><span class="bi bi-chevron-down"></span></span>Example{% if entry.examples | length > 1 %}s{% endif %}
</button>
<div id="example{{ exampleID }}" class="collapse mx-3 small d-print-block">
{%- for example in entry.examples %}
<table class="table table-borderless table-sm w-auto">
<tr>
<th class="pe-3">Command</th>
<td class="font-monospace">jq '{{ example.program }}'</td>
</tr>
<tr>
<th>Input</th>
<td class="font-monospace">{{ example.input }}</td>
</tr>
{%- if not example.output[0] %}
<tr>
<th>Output</th>
<td class="fst-italic">none</td>
</tr>
{%- endif %}
{%- for output in example.output %}
<tr>
<th>{% if loop.first %}Output{% endif %}</th>
<td class="font-monospace">{{ output }}</td>
</tr>
{%- endfor %}
<tr class="d-print-none">
<th><a href="https://jqplay.org/jq?q={{ example.program | urlencode }}&j={{ example.input | urlencode }}" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
<td></td>
</tr>
</table>
{%- endfor %}
</div>
</div>
{%- endif %}
</section>
{%- endfor %}
</section>
{%- endfor %}
</main>
</div>
{% include "shared/_footer.html.j2" %}
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/autoComplete.min.js"
integrity="sha384-xbzjoN6H5XHmAqoSSR42hZVRninPGx85y+XZQGlWxVu2y91lTmr/oD80i5cjeUBv" crossorigin="anonymous"></script>
<script id="section-ids" type="application/json">
{
{%- for section in sections %}
{%- for entry in section.entries %}
{{ entry.title | search_id | tojson }}: {{ entry.title | entry_id | tojson }},
{%- endfor %}
{{ section.title | search_id | tojson }}: {{ section.title | section_id | tojson }}{{ "," if not loop.last }}
{%- endfor %}
}
</script>
<script src="{{ root }}/js/manual-search.js"></script>
</body>
</html>
-99
View File
@@ -1,99 +0,0 @@
<!DOCTYPE html>
<html lang="en">
{% include "shared/head" %}
<body id="{{slug}}" data-spy="scroll" data-target="#navcolumn" data-offset="100">
{% include "shared/navbar" %}
<div class="container">
<div class="row">
<div class="affix" id="navcolumn">
<h4>Contents</h4>
<ul class="nav nav-pills nav-stacked">
{% for section in sections %}
<li>
<a href="#{{section.title | section_id}}">{{section.title}}</a>
</li>
{% endfor %}
</ul>
<form class="form-group" onsubmit="go_to_section(); return false;">
<input type="text"
class="form-control"
placeholder="Search"
autocomplete="off"
id="searchbox">
</form>
</div>
<div id="manualcontent">
<h1>{{headline}}</h1>
{{ history | markdownify }}
{{ body | markdownify }}
{% for section in sections %}
<section id="{{section.title | section_id}}">
<h2>{{section.title}}</h2>
{{section.body | markdownify}}
{% for entry in section.entries %}
<section id="{{entry.title | entry_id}}">
<h3>
{{entry.title | markdownify | no_paragraph}}
{% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}
</h3>
{{entry.body | markdownify}}
{% if entry.examples %}
<div>
{% capture exampleID %}{{ "" | unique }}{% endcapture %}
<a data-toggle="collapse" href="#example{{exampleID}}">
<i class="glyphicon glyphicon-chevron-right"></i>
{% if entry.examples[1] %}Examples{%else%}Example{%endif%}
</a>
<div id="example{{exampleID}}" class="manual-example collapse">
{% for example in entry.examples %}
<table>
<tr><th></th><td class="jqprogram">jq '{{example.program | escape}}'</td></tr>
<tr><th>Input</th><td>{{example.input | escape}}</td></tr>
{% unless example.output[0] %}
<tr>
<th>Output</th>
<td><i>none</i></td>
</tr>
{% endunless %}
{% for output in example.output %}
<tr>
{% if forloop.index == 1 %}
<th>Output</th>
{% else %}
<th></th>
{% endif %}
<td>{{output | escape}}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</div>
</div>
{% endif %}
</section>
{% endfor %}
</section>
{% endfor %}
</div>
</div>
</div>
{% include "shared/footer" %}
<script>
var section_map = {
{% for section in sections %}
{% for entry in section.entries %}
{{entry.title | search_id | json}} : {{entry.title | entry_id | json}},
{% endfor %}
{{section.title | search_id | json}} : {{section.title | section_id | json}}
{% unless forloop.last %},{% endunless %}
{% endfor %}
};
</script>
<script src="{{root}}/js/manual-search.js"></script>
</body>
</html>
+14
View File
@@ -0,0 +1,14 @@
<footer class="bd-footer bg-body-tertiary">
<div class="py-3 text-center">
<p>
This website is made with <a href="https://getbootstrap.com" target="_blank" rel="noopener">Bootstrap</a>,
themed with <a href="https://bootswatch.com" target="_blank" rel="noopener">Bootswatch</a>.
</p>
<p>
jq is licensed under the MIT license (code) and the
<a href="https://creativecommons.org/licenses/by/3.0/" target="_blank" rel="noopener">CC-BY-3.0</a> license (docs).
</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
-10
View File
@@ -1,10 +0,0 @@
<footer>
<div class="container">
<p>This website is made with <a href="http://www.tinytree.info">Bonsai</a> and <a href="http://getbootstrap.com">Bootstrap</a>, themed with <a href="https://bootswatch.com">Bootswatch</a>.</p>
<p>jq is licensed under the MIT license (code) and the <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY-3.0</a> license (docs).</p>
</div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha256-Sk3nkD6mLTMOF0EOpNtsIry+s1CsaqQC1rVLTAy+0yc= sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
<script src="https://twitter.github.io/typeahead.js/releases/0.11.1/typeahead.bundle.js"></script>
+23
View File
@@ -0,0 +1,23 @@
<head>
<meta charset="utf-8">
<title>{{ headline }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="{{ root }}/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ root }}/icon.png" type="image/png">
<link rel="canonical" href="{{ url }}/{{ permalink }}">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.1/dist/cosmo/bootstrap.min.css"
integrity="sha384-dulfW0vmzZ638jigSgZXvDxMmd70GCnIv6oa+riKq6Kk4E0MKf7qmBfwP02wltv5" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"
integrity="sha384-Ay26V7L8bsJTsX9Sxclnvsn+hkdiwRnrjZJXqKmkIDobPgIIWBOVguEcQQLDuhfN" crossorigin="anonymous">
<link rel="stylesheet" href="{{ root }}/css/style.css" type="text/css">
<script>
(function() {
function setTheme(mediaQuery) {
document.documentElement.setAttribute('data-bs-theme',
document.documentElement.style.colorScheme = mediaQuery.matches ? 'dark' : 'light');
}
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
setTheme(mediaQuery); mediaQuery.addEventListener('change', setTheme);
})();
</script>
</head>
-17
View File
@@ -1,17 +0,0 @@
<head>
<script>
if ((window.location.host == "stedolan.github.io") && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
<meta charset="utf-8">
<title>{{headline}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="canonical" href="{{url}}{{permalink | remove:'/index'}}" />
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/spacelab/bootstrap.min.css" rel="stylesheet" integrity="sha256-j7Dtnd7ZjexEiPNbscbopFn9+Cs0b3TLipKsWAPHZIM= sha512-RFhfi6P8zWMAJrEGU+CPjuxPh3r/UUBGqQ+/o6WKPIVZmQqeOipGotH2ihRULuQ8wsMBoK15TSZqc/7VYWyuIw==" crossorigin="anonymous">
<link rel="stylesheet" href="{{root}}/css/base.css" type="text/css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
+40
View File
@@ -0,0 +1,40 @@
<div class="container visually-hidden-focusable">
<a class="d-inline-flex p-2" href="#main">Skip to main content</a>
{%- if navitem.startswith('manual') %}
<a class="d-inline-flex p-2 m-1" href="#contents">Skip to table of contents</a>
{%- endif %}
</div>
<header class="navbar navbar-expand-md sticky-top bg-body-tertiary d-print-none">
<nav class="container-lg" aria-label="Page navigation">
<button type="button" class="navbar-toggler" data-bs-toggle="offcanvas" data-bs-target="#navbar-collapse"
aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle page navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="{{ root }}/" aria-label="Top page"><img src="{{ root }}/jq.svg" alt="jq logo" style="height:1.5rem"></a>
<div id="navbar-collapse" class="offcanvas offcanvas-start navbar-collapse w-auto" aria-labelledby="navbar-title">
<div class="offcanvas-header">
<h3 id="navbar-title" class="me-3">jq</h3>
<button type="button" class="d-md-none btn-close" data-bs-dismiss="offcanvas" aria-label="Close page navigation"></button>
</div>
<ul class="offcanvas-body navbar-nav me-auto text-nowrap">
<li class="nav-item d-md-none"><a class="nav-link{% if not navitem %} active{% endif %}"{% if not navitem %} aria-current="page"{% endif %} href="{{ root }}/">Top page</a></li>
{%- for item in ['tutorial', 'download', 'manual'] %}
<li class="nav-item"><a class="nav-link{% if item == navitem %} active{% endif %}"{% if item == navitem %} aria-current="page"{% endif %} href="{{ root }}/{{ item }}/">{{ item | capitalize }}</a></li>
{%- endfor %}
<li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq" target="_blank" rel="noopener">GitHub</a></li>
<li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq/issues" target="_blank" rel="noopener">Issues</a></li>
<li class="nav-item"><a class="nav-link" href="https://jqplay.org" target="_blank" rel="noopener">Try online!</a></li>
<li class="nav-item"><a class="nav-link" href="https://raw.githubusercontent.com/jqlang/jq/master/NEWS.md" target="_blank" rel="noopener">News</a></li>
</ul>
</div>
{%- if navitem.startswith('manual') %}
<div class="container-searchbox form-control p-0 d-none d-md-flex d-print-none border" style="width:16rem">
<span class="bi bi-search my-auto ms-2 me-1" aria-hidden="true"></span>
<input type="text" id="searchbox" class="form-control border-0 px-1" placeholder="Search manual" role="combobox"
aria-label="Search manual" aria-keyshortcuts="/" aria-expanded="false" autocomplete="off" spellcheck="false">
<kbd class="mx-1 my-auto text-body bg-body rounded border" style="padding:.1rem .2rem" aria-hidden="true">/</kbd>
</div>
{%- endif %}
<a class="d-md-none bi bi-github fs-4 text-body" href="https://github.com/jqlang/jq" target="_blank" rel="noopener" aria-label="GitHub"></a>
</nav>
</header>
-27
View File
@@ -1,27 +0,0 @@
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{root}}/">jq</a>
</div>
<div class="navbar-collapse collapse" id="nav-collapse">
<ul class="nav navbar-nav">
{% for item in navigation %}
<li {% if item.permalink == permalink %} class="active" {% endif %}>
<a href="{{root}}{{item.permalink}}">{{item.name}}</a>
</li>
{% endfor %}
<li><a href="https://github.com/stedolan/jq/issues">Issues</a></li>
<li><a href="https://github.com/stedolan/jq">Source</a></li>
<li><a href="https://jqplay.org">Try online!</a></li>
<li><a href="https://raw.githubusercontent.com/stedolan/jq/master/NEWS">News</a></li>
</ul>
</div>
</div>
</div>
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
import jsonschema
import sys
import yaml
if len(sys.argv) < 2:
sys.exit("Usage: {} MANUAL_FILE ...".format(sys.argv[0]))
with open("manual_schema.yml", "r") as schema_file:
manual_schema = yaml.safe_load(schema_file)
for path in sys.argv[1:]:
with open(path, "r") as manual_file:
manual_data = yaml.safe_load(manual_file)
try:
jsonschema.validate(instance=manual_data, schema=manual_schema)
except jsonschema.exceptions.ValidationError as e:
print("Failed to validate:", path, file=sys.stderr)
sys.exit(e)
Generated
+982 -312
View File
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -5,7 +5,7 @@ Name: jq
Version: %{myver}
Release: %{myrel}%{?dist}
Source0: jq-%{myver}.tar.gz
URL: https://stedolan.github.io/jq
URL: https://jqlang.github.io/jq
License: BSD
AutoReqProv: no
#BuildPrereq: autoconf, libtool, automake, flex, bison, python
@@ -52,7 +52,6 @@ rm -rf %{buildroot}
%endif
%{_datadir}/doc/%{name}/AUTHORS
%{_datadir}/doc/%{name}/COPYING
%{_datadir}/doc/%{name}/README
%{_datadir}/doc/%{name}/README.md
%{_datadir}/man/man1/jq.1
%{_includedir}/jq.h
+11
View File
@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libjq
URL: https://jqlang.github.io/jq/
Description: Library to process JSON using a query language
Version: @VERSION@
Libs: -L${libdir} -ljq
Cflags: -I${includedir}
+522
View File
@@ -0,0 +1,522 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
# needed for multi-threaded programs (defaults to the value of CC
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
# special cc_r/CC_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
# CXX="$PTHREAD_CXX"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 31
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = "xno"; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items with a "," contain both
# C compiler flags (before ",") and linker flags (after ","). Other items
# starting with a "-" are C compiler flags, and remaining items are
# library names, except for "none" which indicates that we try without
# any flags at all, and "pthread-config" which is a program returning
# the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case $host_os in
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
[
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
],
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
;;
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
;;
esac
# Are we compiling with Clang?
AC_CACHE_CHECK([whether $CC is Clang],
[ax_cv_PTHREAD_CLANG],
[ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
],
[ax_cv_PTHREAD_CLANG=yes])
fi
])
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
# Note that for GCC and Clang -pthread generally implies -lpthread,
# except when -nostdlib is passed.
# This is problematic using libtool to build C++ shared libraries with pthread:
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
# To solve this, first try -pthread together with -lpthread for GCC
AS_IF([test "x$GCC" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
AS_IF([test "x$ax_pthread_clang" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread"])
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
case $host_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
[ax_pthread_check_cond=0],
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
case $ax_pthread_try_flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
*,*)
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
PTHREAD_CFLAGS="$ax_pthread_try_flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
PTHREAD_LIBS="-l$ax_pthread_try_flag"
;;
esac
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
static void *some_global = NULL;
static void routine(void *a)
{
/* To avoid any unused-parameter or
unused-but-set-parameter warning. */
some_global = a;
}
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
AC_MSG_RESULT([$ax_pthread_ok])
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[ac_link="$ax_pthread_2step_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[break])
])
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
])
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
# Various other checks:
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_CACHE_CHECK([for joinable pthread attribute],
[ax_cv_PTHREAD_JOINABLE_ATTR],
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $ax_pthread_attr; return attr /* ; */])],
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
[])
done
])
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
[$ax_cv_PTHREAD_JOINABLE_ATTR],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
ax_pthread_joinable_attr_defined=yes
])
AC_CACHE_CHECK([whether more special flags are required for pthreads],
[ax_cv_PTHREAD_SPECIAL_FLAGS],
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
case $host_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"],
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes])
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;
return i;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
ax_pthread_prio_inherit_defined=yes
])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != "xyes"; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
],
[
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
]
)
])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
AC_SUBST([PTHREAD_CXX])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "x$ax_pthread_ok" = "xyes"; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD
+6 -5
View File
@@ -1,17 +1,18 @@
#!/bin/sh
#!/bin/bash
# This script builds the website from the docs directory of
# the current branch and copies it over to the gh-pages
# branch.
set -eu
set -o xtrace
set -eux
shopt -s dotglob
# build website
scriptdir=`dirname "$0"`
scriptdir=$(dirname "$0")
cd "$scriptdir"/../docs
rm -rf output
rake build
mkdir output
pipenv run python3 build_website.py
cd ..
# copy to /tmp
+10 -7
View File
@@ -1,10 +1,13 @@
#!/bin/sh
set -e
cd `dirname "$0"`
if git rev-parse --verify -q jq-1.0 > /dev/null 2>&1; then
git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//'
set -eu
cd "$(dirname "$0")/../"
test -d .git || exit 1
if git describe --tags --match 'jq-*' >/dev/null 2>&1; then
git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//'
else
b=`git rev-parse --abbrev-ref HEAD`
c=`git describe --always --dirty`
echo "${b}-${c}"
branch=$(git rev-parse --abbrev-ref HEAD)
commit=$(git describe --always --dirty)
echo "${branch}-${commit}"
fi
+29
View File
@@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGTC/RUBEADN02309KT3tmV3Wo8fZwVo2G/0z4XSuuzhnpGo5lJfTQ+rAzth
V4F9lrvakCUYhTrKe/d4Zv0uNWEV9Iz3G+raMLKY99X23OHoTBe4JLCCuV3nSEBF
+SNAoUW9VTBuR5UHNZ9fLsGpqbJSYFx5oU0xfMHWKirriIWkq/u4iTbgzX5keJRG
cCP9d3j5Hki7FSzHofzG5m/OBNIpTu2oYh+PuqlORmoaJ/bL/8ANa5CeFQHnkeHD
62zW1/lhuELUzFd0K+H/m4HmEv1u8XVMfnZM0cxSIAfJoV+vjlmmos6A18AHWqal
C6yS0OYWXxB/JbAVMGRtdKfoFSjMmQWTEUEFmMmHOxdriH/QN6O5X0kq6ZVCJPEK
0unzJRQn27hHH3zsHXZyIjF/W+pXCp0jtaQqF4AQW8GDL5wP5glS3yfvtbQQfL/R
qVSiU4SkM/5w6gwHPHR5jxibbHmuIqyIe0JjTNJJl9YvNcjM4rbIi6TZx8rh2BrP
xY+j6gBr0/clnFxB3O2LsfxhWTnZ1lmJb0M6n+ih8+371JSvEupqe9px18FsuxnM
8oQ5jF6LVSTxfydSPtBpofLz3/oGGmDkMGzVN1gsTxHJ2dG2u7G/VUpMSU7OPoRJ
a1rtNW4/Hgl9le09dQfus7grp70Lm6yaut60sbo0zPlAZdB57SDLwDSreQARAQAB
tDdqcSBSZWxlYXNlIFNpZ25pbmcgS2V5IDxuby1zZW5kLWVtYWlsQGpxbGFuZy5n
aXRodWIuaW8+iQJUBBMBCgA+FiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTC/RUC
GwMFCQPCZwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ4aewjAfp7oYiTw/+
InD6e3o6Z8Cx1RNS37xZTgI2i+eA8N2m2drK8EybA5LOPjXEaSPeXDpOR0LkhiT2
uashRsHonNgrH3MfGxGa7C5rSbMiN0Lqp+IML4Z3x6PLLENGWYtZGk0Z3xfmm/HH
WV565xPJ3JtFRDtx11XaRRRPNrNojEKAcc9C06YPVfnVmIPVhi3ah/x4K+qMalGt
u1i+2OjC4+bdNkNhImnhOuQ+3EvxE7ocpEkI+z+8PnLFzjMXAnVslLf+oM1TmS2P
rv2xIXGGet41f0ube0d2pLIZEwv3NLAdlRvTysBLoE3VwbWV91GEH5U5gkf+rkLJ
cOBuZ4/mw+N3aVjMDD4sBiuNAY3WlwJf1otdzf/WB5JOsscgU2efs13Crjl4UQuz
fPHzzGpTJiSrBmFFURshYnwJsKzftil62zKoBA982jpmWIrOdDPcTe8ypT59MTvx
U/LelumomNfGHbNIbzZ2KBOS6hV38C7HrSqRRwV+lBenq6TTuiYT0BJaxPB1rPdT
39WS5JzllC5G5HmShzePrc9y+17+BIGyA+Cf1eOV0Jz8qtvgDvP2K7I0my0/+NJ0
U+fEFKul1TWgM5Jwqd0g6FBmjn2ZUuENyIk1nLcry6aRf3I4RLFopYzkbFf1u1PZ
FP7L7aCLmof0hsMiOEd9yAgiq20kdU8jx+NwkFBpDnA=
=ZgkJ
-----END PGP PUBLIC KEY BLOCK-----
File renamed without changes.
+1
View File
@@ -1,3 +1,4 @@
998c41babeb57b4304e65b4eb73094279b3ab1e63801b6b4bddd487ce009b39d jq-1.4.tar.gz
1dee4bd2516f699723f373b2629c9173ce123b92c3a72520d0e25fcd8e3df45c jq-linux-x86
b9b63aa4b3cc85df8bdca884effb69d66e9ebd717454a9e212d9423ffe3e955f jq-linux-x86_64
6ab184edfa04d6f662a696d8594f19532ed78bc6fd05acf4cf506e789914300f jq-osx-x86
+2
View File
@@ -1,3 +1,5 @@
c4d2bfec6436341113419debf479d833692cc5cdab7eb0326b5a4d4fbe9f493c jq-1.5.tar.gz
77c2e4dd9e92c58a662582a24109330a8a94562c50c52f837f59122a951b4ffd jq-1.5.zip
264118228c08abf4db8d9e907b9638914f3eadb5cd50dc1471a84463f7991be0 jq-linux32
c6b3a7d7d3e7b70c6f51b706a3b90bd01833846c54d32ca32f0027f00226ff6d jq-linux64
386e92c982a56fe4851468d7a931dfca29560cee306a0e66c6a1bd4065d3dac5 jq-osx-amd64
+1
View File
@@ -1,3 +1,4 @@
5c33ac16152344893f596d2c9f256b6cee6e925e53718c94d24049b640ea955f jq-1.5rc1.tar.gz
dfbb2d073d2df9ee0bec44b60bd81e213b7881b27fc38d7438daee9eded2b75e jq-linux-x86_64-static
bc370e22a11c85c525ba1965760faa5273aa3cd0ae69b030de4091fc776538b2 jq-win32.exe
6fb6f39d847df57b481d36941216c770ccf5f97c36e5373a0c93e63b5506c9f8 jq-win64.exe
+2
View File
@@ -1,3 +1,5 @@
2fd209ca34d0891499bd32f59ec332b0b3048c449c388d428e5c5e8132a13e81 jq-1.5rc2.tar.gz
fb7c57cbce7073ec18f669a313e956864dfafc58bb0c1a158881335ad7daeb58 jq-1.5rc2.zip
7ece904edef3f951ca0c6f68cdb14e782d52aa46624fe2de9cfabfbd98fe5797 jq-linux-x86
cced974e1f2c50d6203e09c2e3ede44075c4f35601233378deaf7bfedb2b4aa9 jq-linux-x86_64
25f930463c94414fbff1ba5d76a9547259073e8acb19f709880e913ab58586e1 jq-osx-x86_64
+2
View File
@@ -1,3 +1,5 @@
5de8c8e29aaa3fb9cc6b47bb27299f271354ebb72514e3accadc7d38b5bbaa72 jq-1.6.tar.gz
e33f9219cd8c3851b411215dbac51d7fcca4a2b157964bfcfa56a1d718e2de14 jq-1.6.zip
319af6123aaccb174f768a1a89fb586d471e891ba217fe518f81ef05af51edd9 jq-linux32
af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44 jq-linux64
5c0a0a3ea600f302ee458b30317425dd9632d1ad8882259fcaf4e9b868b2b1ef jq-osx-amd64
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxAACgkQ4aewjAfp
7obZsA/+L6N/p9+VrkfmdY7b+HTQ+0R+o3cnD40MfiwS2DMOi43fTp3GaXxctU8E
UqPWO1CcV+prjK03fOvnbtRD04B3oCzQkNed9L//Nu6ZtMHZoi1sVMTQpVAC8MH0
WGWjM9axZYyh+ZFZ97CLm+y4OsY7f1yS1hEyaKEXcnK7M2BtLEVfiO+N+ll0guBU
068Uuf/2wXtjPR2Ol8AWUnyJcrcVtAgwheDT4vJackMbQDzanlbChyEMFTvJrZCN
Cl2ug0PIcgVpwJcRAQuKE/26UEoN8wSpWgL4gFHyQBNwz/iPwM7ZBbT/h//i/aOe
YbJ711yTtKcbPqWhI7pOyoSl//XPFK6sPMrYUPwHAcykY2nGLilhqaoE2BfTuthj
1Tc6KCz7CEqmouyjeTiKbTdht0hE3fIgZd7D9chtVf4tR59wNpdo26vFdJewSqf3
jrAhLoRt2koPP09atOtlxbBv1/tk7yKi+tSO9czhPaRAam9cHFC5ZfRkZ/6KKjSr
8x6h0eWF9XJMpAh/tNebZEhQxwIOuthQm/BpNG2e97nszVWmAVGIKIG9MyY/ktj4
oHUU7LoljUoB5IZtOeueNkkkktzvm3L7nUvXYE0ZUhKxg2LkAxk55n3hWGcqmYoP
RlBHeLGuXr2IkA09biUB63g909gpGu9u95trCl3GcqpykFxxKh0=
=T2uG
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp
7oaSAxAAhK483fmOwxxGdpaoIGsRGhQ3RtX/GIVER9P8wD9aP9WjGKFxtlxTvv5J
Et4FNBobPCRo89zspGjp+nZ8UC0ai5mH0gpZz17j9X/+zDKygA1jtrvv7f7s6jhm
dZZMsDUZDjQvZOw6JoYOqwzzihP4O2oq3qjrqqcLQQCyKvT6nZto76huwYal5zj8
JYNP9JjmXFi2LOGz11qL/5nxXVp3uprdaAWwJmagiPFOhLg9MG7ndp4IhvyeHa9W
XLLCLHMRoBAeglmABasthCFRlH1UDjbYIqswmya6nxbHi2RREptU+plXuM8LXJhB
UAZx/i8CiFgcAOYCf5YYMoDBY1HW2W2pIL7Jyg40QOk2Pb3AXseWXKtqNh2aFVpk
TbTXrfSpEerZKzncPphPie8Y091H3q7/g82r0RaLvsHgCPhSwvLeH2LKWndoXWoK
h3h1FT9SuruDmOeD4B0N8U4rPaT5DHf01M4QZSXeJizkl1x2oi8E7Uv8bT+hi20y
FGQHa7iyENQtmyynFqhB1Bkhu/lLMj+e1croPJxS03WUIIGp/iUjJJO78Fn8givU
zcCNUDvMI3o1brZxcbxqgAlC5DIQ1hq7WF8lhnlVC1e0tmblmzDe6zc7bVUn/hcR
djbGJphfo+04b+m/qJNZrQGuzjvPNaL6c17ta4Zm7SW82SvAIMY=
=o6T7
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp
7oaK6BAAtueni5q5AF+ISok5RcqIaz6UrWXt3oQiNd+MFJkpz6LML8uVWfbEwCBR
rNbuJC/HKKhBkIRwnvRpHOd+MGZMo2M93eaMgCA5hN9tCvorbVHakeKEzbcn1mC4
CeK9BDDZEuacPX2ODVweFupsUWHm8pWMw8998/ujFIvOs/D0u5HhxT43gSdJzfXU
GVDJzReikeE3neaUDGeqok6zd3P6IrY1vR08YRkaNEz7gcMgeZSC6AdA0LmsJvIA
pm2b2Wb4s5D7jJ4LThbPcEZ/LV9IhLKvCxHPscKX5odfXPGWUshmBUl/fp1H21MN
qQmMR9o1G0Bo3T/KRdXrZqVowAH2RV4Mkte+a9Kml3qzSSNkbYY5uKWG/2atAoXF
QwvlrcV7DwffBJOiDfKqmlUM03bBKrNCnxycCtTc32X/UngzF422mg2zLDFYEagy
Jy9FQI8H6FTokw/atSpxOypaD49jHl8rlX2jEzKLnycQNRpUIOkdzUVZ+fhMFplr
ZWBagyUtO6iJmalWJmbnCxn5ZUBbghNN0U6r+Hk4GNQ9RmSGIbbkTCtRHws3UVHd
7qgr8j9xPwoC1mnH/HGx+bAlqnmtlTP4UFX58NBewFs2OyGaXh8IRquEkYisR45b
PVXAedSRGP9h4uS8NmWVoGIcjdNL+p3nV6Qx1JsjvqPesp0Liwc=
=eqiS
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp
7oYWKw//SQvepElA99x9XFFCH2L6t+RqDMWahTQPCzhgUD6kzTsr84fnrASCN0S5
OqdN3qtv6b36y6ynoVoF+L1sBCPOpTtvLeOgHtXVXNjpmYftA0XXYOwhjiGDvc3o
unL99rPgyv1dPs8V4kvGi+4wCqieLXmC812DJc1lU6thJqM8fkwPt1+ym362bFM8
CmJZQTGNPKqV3M1g8PAHbdRqskl3EIfs458t07qC6wG0dqX9MApiITpsJ0pJeLF0
k1m/JDFhOdwqSffQz1BkwnPDlpGrIiaZHVhOUz4rCZi99cwrPJcvPZHE2uQQQAq/
UAFYrHXRQcoMd/iMovLYgDvI8tsFBZ3bpsozL0Vr7waJ/clIf1ovRfaDXoyp87UN
v62y8PQRgs5gsorzMlgaS3yAkU4WmMl/u+r7hZHHcD2Kqj3X4V2vZgcJD308rtl0
e8/BLl5byoP3gWbykf56Lea6ieyWotnV606CR4fGevmW27pGq8Yr1H9MOi+yidZp
qmglCLysnXrP8562awX0WEn+7c1Z0RqhpLbw+MuB5to1VpjTPQ0kkLSVvdVItaio
EtaxFmQrwAz438Jz5zENJSxYpxmL2gZ0E/lXxfli1adAWHjaGmraGEENC44hBmVH
OnJ3G47lnd09v5/BfWO67aJzN2UR4LDmUYea3vj0MWaJC3SkHMc=
=7+Aw
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp
7oYNxA/+PHvmlCmGu4t4mgMfI/PI/o3zFRse5k9/TGqRTjV4bVtvnXJem36GJOyQ
mIgfB/QEwbagEqDAX+zs70uzxl/+q+c4/UDzWM4jz2Kblxa++Wx1AeBxy+fQFwiR
izgwlA826KAW1vB9M6ylLIb1txD/kheEObh/OMQiNO++CLuQaQRP0jDLdYUOWrZX
rzpO3gqCGBWwrpxb4t01yNPYLniGcKIGJl3y854RzUqAXA+hqIzcsoNowqyazdFz
9jM1e7JH3xToBy+xQkOOlRh8X//QUKEzSfLRWwGE/FXRnjLSF/sVNrlCsKS9OUus
ChY9K1lq+TRTSi/Kzl+gIWZdVBLhCFF98wC5xwmC+x2o6vzCJozgbmyRRFNDCg6Y
qvwI7RlTaZz0qNPfBu+EEz0RTkLTuhyNR7wiywWNAGB+ksxCtVspjqu1wmfYWIBM
N1gWTHQ2oHBi9/uRmtllt+PinhLL/CnJCWwfOTDziR6TmEOA+FieiCsJHjrzVxdD
NkGGGlmT7VxJcwkBQ+4BXVGoLmYRmj3C1FCeX+PPEfsUGpi1gBh5k7dnBOyzJO4Z
yhlDz9UOF++GRYvR93kakqbxJdd0pG+iZMh5QNpkpJxtmdUZbKRu49ZxNx8K2yIF
mSdMrwRBq/2p0orB73EX54v2TayxhWjjMm+Pfq+XDr8yFVnG3yo=
=xo2h
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp
7obqrA//SR6Y+axdJGq9fQJEQnXTwQywHvFR+/bG92tUDlPPTBp+YmNfk6Rfyygz
aqjQDePJvxzIAcMsZhHdiyJUk7AMNXruVsSQK1Z2LEBwYlnVi5t5abyHkvZ6hcsn
Uy+I7bhZ8fJrIUYNEydA+KygziKb8QVnRND0dNb1F6MWp/pRXWfv1jfw3iuCNpb2
vYtXpTVB5QEbkqi+tXvAZHLWqIbazLLG1zaHSpYBi5afhBZSaZyBDcDJ93xDmDCO
Af/UTFQK9h8Q0PWt3aXEBMLd8M7qT66SwbMSveYohBcgxDChoZp0r2Ysy1avXEFc
rKNNUPiUnRXCJido3qNpX07b7K1wGRMak5wN8gKM4OCsDyNEerRhEBZP0eVwNqiq
uZdez0civ/1PVoW84+P67jK9kw1CMP7E2v5tHQKRelHMhxzDCeKShiMyFpex+4X6
wBdu2V1Bn32/mlLOvMa6XGoqBBGb0xOAxVmJppaHcGbgje7zn5XE3M9mNR9k8s+A
E3KFosKRkItAgTLZyCy5jSbYYynALxfF0dXkM8RchJH9XLJp5zIiDYxm9nAMhk1Z
DmRDHX+DuEwLk7mAI6eVYvgbMxjrrX3HNlwadWyL+9u8eT/OMqCjIAPQjQCsjh1g
SWFutFAuMcmXWgtz3jFrAnleL2g3XdJpbAst3TJm4WvJUucRXMQ=
=vNoM
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp
7oaTRhAAwV64hEwV+kfjTgHVoBfjjztLYfZT/ZYMbGWjIJ4JdTtBcT1jMhdLYfQ4
ACsPcaGfb5nGmA8B4oPS7mCz4wLZCCVCNG0bYoBgWrm8AVcoLeytsx19iBlkCICW
73vki8UcvmtYHF0lwKxyD650nrUZDPB4hLQJxNrluOxHa1K1lfsoZgpZkPLXp9p8
fxNqmx0a87JFT1fcVmN/nYmFM14DWohR4IpG1qfI1HpXFOGngEfZrK/DKfajKXnv
eNymIXhJ82dd97hN1eCTSrvee7Fa+xKGQpWtfffe+cTsdLtVq8KH1HRz5QxZZcCG
RmJElICBadUfEQDoasi74XUER6NfLKtqWfwXMFsUDj7ABZi3a8tTSwgaa7QuwsM3
WyrenZgr04v0xAx0P2paZrbU0HzCrANzW/AzJE6fF4Cn8mB6k6tm8NLPoRDEVWga
68nF5ZhLeIiVOzcO8PGBB+vZ5f2ni0kW2rEjbPf6r5Ixmx/8OnSbMhfCHsJB08VC
K+u5UY3eTvJnY9ykAmFds92FILAa1lhJ3XLUkE/+vgsLVRyZ4Pw+CqWVdHh+N2Jb
y0AwwyFvFJQgaNrNh3VJPtNWu8fFWfr2gFJOuHUDJQ1YZ2IewOk1HMrnGJI/AVml
O3i3oiP/HV49WHboUtdeekqDQq0isewOQOcma0ParceC+uTgn+o=
=+6c1
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp
7obugRAAgEZOs0LxDS8hjwpDdOgMJ17FrndBgouih3Pl3yFJDWalPLY+GoOU+ZKH
18JhwfWBBmuDqUiq4awmhFPPOSo98Cw5bBa9XXpIltYNeZnv3L/3rL19E20kQQV0
0ZjJwvEpsuUKWFPMIVx+7fkKZjD+W45rdCmTlT4W3hVPa+loZx1xEa32ZRlPWlyK
NuFFImRrESADd+Q3nZeaBWoTBi0Ec5RraPVHDB9PVAIx2nyjnxeLXRL/T+Wn3psr
7g2nC+2mH+e44QqQ0NBGmLlSOfJID8JaH4dOJs7eDVlG05KXGcGKM6j/gEEbfZqj
lnxAAJO+iyW/gWFPDRO77DR2H0ATRvvWoSV9zi/eYcZcqT6T94gSWd/wX3GqNE9/
IbERzYbSNUTsfWdHIleZ4GDw6FvjQrLywenDuEvGuDQO3eEvbS/5Ydt7DH+RIQWG
U5lv9YitMcKLXUOaNEELEL3IExdoYxri9+LU0b0hJhHk/plo6b08bSlVzSqG0Ra2
fWYdpsyPMgeEPvt2sGVjIcW8j4m9PPfJJGIjghLT6Lix5fnEv9gsf6CZOLt2uBh4
+RN6so0vHXbrEz1cB3WaIFRu5Ey6xZPw+WgTJnHJE2ESGxfgGW9VFgKDgZ7Fb4CN
PZon+o9ZuWgBFfGjSQsaOEHuRa7OyswxcUNC4ZLrDZcTvS02cV8=
=rD+N
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp
7oYswhAArfV8OeY4on4twFOIrnV1a7S+bxc6UwTT9F74nzyG1dTLmJi7SRGMQg2O
kbdJdRKidNmrDr6uTQzTw2+q0uYzjq2l5Zjsza///KB0/6oS85D+9oFK/X4bmlFM
5xZu+4ZQNjw8NjyHSQpHcV4DAz7haeSUorvr9AR/5x/Mr0rPQrRPXOKzbgXXOkiS
LX/6yyTmBFQ6LedrEqYulaVw9nJTY+l4mWBr+xuA8B+G+VsG8IV53OjyhhXE0RB/
4xt20mqtQLvuc7VSEL9kd+Qpv/cq+7TgFabIEe/09GgZbQcU/yXGIURoj9lLjSzh
j46NKIk1MvML7h/RwY3JZ7CqJcRFmDJMBSjuSLsKV5cq3tkGw7An0QV2WPeOXHg1
qG8YNkLaG1mnRZjEFM1m+czt4vHqFeppJKpmrHgA5Am8VGcrORzJ0A0nPesQfv/+
5PyprSeUZZt7PMt3v5rnEfS0VUr/+SmHAY0LVAgALcZjZaddEo8wFFU5uK4RNWrN
SPUCW0x4sZq7ctpBP4YYAq21o3xqWd9x3e/ikchenI47algbA9uWQpBB6GWVfyzo
8wkT2wHCAr6abZFWVdaFzv1EPUkL6BMZ2giswKD56CQjFCaOPIMBEXqLr2BmFj2L
2YcYTvFeQz/A4SokXy9gcqOiWabZQzSG2iFXiiyoi/8ovcZd8HQ=
=FEgZ
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp
7oZ9pg//Tro3RosTB+zEFStPN9afpd7s1ZRR5xpkfp7gCfxJVyCr9PF9jgp3ZKCi
dwD+3TBawM+ruaTWcAObR8dfRVMoFudl+PEj2zl7aG/LwkRawNs3X4tJCIrhx2/k
o2uZaDO1t11cDNgIoTvviNxp5KXTaOdIZvwQlAl83tr/TK4r+olAnv81RX2z8KoB
4gMJPFRWBnv24S2i4cmiw+ktadw9xCouc/iEp91TGSiDJxTADTLYgUxDaG7xg4+a
pucfW2eW4itR7YGSg8ru2+QdPAWWwjn0sG+vZmCkOm62NPqdXX8bGoN70bBzog9h
MonU89BcrONHd+vWZos9bXvj4hIHkZybKLe8SvLH/7vyoEoNsZCHzekuRzEsDaqo
ZUQlp5ySN+FFvENHZ1uicIe2kwpVJqZsYNHHIMu6ggCm9fELs1UKqBUEY6fSrCXO
XSf6L31BPYxuzr1R/tegwZw7+UWros3GF2Ptc5eTRJANPFVnXyrEcgXIFc9CuJ8g
HwzbMdJMwyEOUqOutE165Pe5Ny4SIPb/SbEfQNQ/EgI1VvJntcLee8k4+xlqx0lP
vk7yEC80NIz/pTrTpY/38EO06xX4SudxjZD3vEYJ0/gkv+xs+flOW+KmWWnXeP0B
d0YJRTvOzgGz65zghKN6xLSp8YWcD4zCNcWMQLesBRrlZgtLnWE=
=h+hI
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp
7oZGVxAAmN/9DKMfAavBxKPqiVrfNH2E9DBRDRNvLg9qDRRJ6UTMCV5hiH4KrIa0
b/Afknew8IKDVFWL6cGBdnA2iBezGSTraOmZOqsrwJC3wqnXC7LT8RVGcURKKDz9
5WMMs6jRJGKwzzIr25NUjeBFFGRuRhe5lI/1vtYdgCpWDXeKhBYkF/JqlCLw79/f
IlLm8ClS5VJKWBbFDKyitW5PiNZsQGiEorECdkjY7C4REoWwbvCQ9bPcVCwEDh6w
wVnXccSFhehPcOyonqWPLxmruYWS9yeOn6UBV9/PqgdYYkUF3plfWpRbg4x7lf3c
dqUTWZAgRgG1UDyQUTg2tvprLmGIoZ7qloBuyXj+5ENhISgjWUZN7cWXAripIfV1
I7LqKH3/4kN+NlXXKnxVJEq8TiIXzkkBUBDMGt3nZ6F4m0lTykv1Z08dNBj5Eaj6
/7Za1bTaqiFZRHvzDP5/YAH913cxUG56P5RHpvRDmP8WHKJ6qnbRTvSl4vHCAvEc
KKbR7B1YRatghoViSSQMGCNXV98GkLx6ix/jmz8rY5/OcXZA+xlhydSWiodM5gi+
ZF+p9Ue3yE+Ea3xVSN2AX46HkkVTVl95zn67iO903VLvKryicFJROBdL6y5+x4d0
I4RSSmVpX2sIb1cnB4ZDUQN1xM/nqzKGACLRq7XdJ3rLbBanJfU=
=dz6H
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp
7oYYEw/6A3lR6zrPHRg5ogawiyDICdfHSO8Dfm5ho1l9N+O9D0w74j1yOeULyBaC
JLT9H11AR6Q6T0Q7uF/UCekgScQfKf2KmiCK95a5laVP8QBXCFarS1SHKup5A4qy
Ogp5XXb+H2m+iv6jStXoBu3h9rsJwYv8YRgpokeiR/sSgUh348lDhFyuNfAljvpJ
9W6jwfwYU5JQNiemFVYhJosSBeY1SwuAz9y6fj9XU46taw/mOdSxEaDqU2k4XWJU
sRONHuJ5VzgHE4q0ookOEkFuf1xgr2OZgviZYQOLmRR3HdULtmLSUQW7w/GPy6hs
I+CDpTfO8uAVO2W21iRwQuHzuuWcGjN7JKTmWSI3DFN6WLPRChoe0CmEuY36PeNA
I5gD3frBcpI01duq1w7KKIJ2luWtwq2J/IeHwlkq6IGSzmM/ys/UT01dYnCQROmc
/63RRryN9/gYYD7SZ/udeGvkRUTpWJi7RxQBaUTqgBFVlM+Q2diF9XffiHyB36Ef
2zMzh5dWbSohN2TDKkgf+10+5n3g/rrgb5k8Rgm2XSwdyRVvBU/8/egPMpmbhl+9
9LPixGljkryTALLk4pImyzqt8MRfMRnQ1vA23jw2Z6DoYpqbOpPODnlmVRdqk3eo
U19lFNg30HgauAS27SRbhL5DsHRwAEqB7ItCR959pg2o42VpjoU=
=ni4/
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp
7oYhQA//bBoU9oPJXhliOhh7egjUX5w0g+ncS8uCJHhQd1zQZtsrlpA4HwFrx7r4
yggGkG9lB2FsMG08la8xglqKix1Vkmc1zCHkufvvbywal78x5rguJrew2bRXR8lH
GtfamPQVjo5seQGD1WspbD3bKBewg3JoxveCA3TbCbnWNeIT7lcuPDp8x4Np/wPj
edmFH9/yEt4aF3o1ISZem/MmveI9LLi9isCzL68SeGNnQJeNHp5ot3Oj5umjx04A
/X+/ZHJ3iB3cifdfrnvzgpu3hTPaTjnHHn8ZOIU/5rOEBkaDyGHiB5B/lMXTd5kH
SkYqSN6fdxPOma1682fXSQAkzp0zvb9gf7mUrHmbjCGKdhOXRw3K1HezO+KLcTTm
YacYdu858UyoIjhOBrtstNY5NebEyY1yaM1+if4/EYgBOAiO1Ov66slqXu9dtR4m
4ybhieGanfbviMss3HeJbfB7bvFtGqSjOKHTm48qszTgclgTpL7cxtVXGlGvocrR
LtIJFJkBukXCkMxd7acvTbpdPEsmnzzhSyP0d6aYfcwCXOr1sR709qEtXDYXQpRI
j+xVW1ZPOpGZhq+FLCzH+JbyQq9vYptL90qMY4Cfr0VL9ODtu6Powid1EbC5Zm9A
Q4JU1uu0M2EzJMA+TTXV09od50Mp2Xii3Nm9CaK8lwi8DEcVDw8=
=wmsq
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp
7oaOTA//XTU4w2GxJJPstaq4GxLvz5/c4a1myMzRvZFRJa6XHzMxzOlBF3jix/qN
GNXqzC6gOejNERKo8eHHGdVJ/LEMW6mWk3JBFTa/Nwm76oMCLSx4J6vY2w4hvM43
cGwpb28sBNEgqpEcZMtHjtR3wvRz00I3+Ph3cEUZuD2Rmw86yWE8zzZWxT1L7Tt+
Bvmuu/7XWC9Tv7KsX+VA3CjcWg9hO8EW1sCHQ8uyBB/c8mhGYGhc9lPOyiAjqC3J
dNrjE16a03zxXo0q5od56mgGo272huK2+vij73B4ybsUxNGrgGPN8b95vtFNb8Wi
NkLd2jaUrlDo1CO/M4/YffYM3F0NnUvfGulcLIyeo6FZ4cGmtQzlOCfkAOuv+vXe
mCqlkCQ7LW8kOUm60g4Q7O3FSNTigQuSOelxv4cxhJepKL5qqAZ7gFCbAUrNbAjG
N4ITjfIfluQ6P0joYV+Zz8yQ7kxS7k65QtBRMjhtkxG2aVoyge3iyhBgVCXy4m+9
GFOkvHu5oR0lm1IZhds8Eeub0QOsMn+BzXT64HvPa6zA1hWabeRMM1q6b0t7xT3q
fR8PBxHixzcniF7Dw6E5OoIl6R8kE5HZ9WtKtup4RyI93m9B+Ku4yXOt9hTSMN2+
JsFf+MiELh3ohMvbtpriybdNQiVAn25KSYa+/g4aAj0CLQIH++4=
=Kf+E
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp
7oaVvQ//W2Vkt4uifSMnnHEvaa5f4S0uTtKgpPSaPUGWrAQAS55e39D8hDGgPDbu
AxTap0BSd+4BW4lKrpJTAGKY+m8lyQS/qyJPA16D6Y6YfYyR+JYxyXZLp8otimR5
NyW4PIw3CA7FEsVMfwBsYe8+byp4wtsv+VVN0JBZHqLMH9TtAEpUMVEQXe2mZI28
WH5ZY7j40MXeItwqQ+Ogov/0GHifS5N0j7KDU7J/8wpB4kLCDoQ9tLXu9d38oO/7
CToHYGR310urjagHG6We4WuZ7k/Euc1sfvTHZ/Rwg14x6oGKoMbGbt8Dj2839ihs
LiO/7ggfcp2jUGvUpSaYYOfcCVRYqFTK/QwWmkvhTMhGRoN+y3VdQTX09VzVhI6g
eEY0RCO9bC+M+gGWXheFiqeEznIKlwDhO33e1qCRMDH3h9pBUlxrlF9466B/u0uP
DXCGo+lAC/NbYUkuYTWtKoi8Q7Sef9EAI4wZ2Y6eYGMxRI8dSrqVKioaLLE/MP9n
uyjv05lwHv6+tntb8sjBv9mpkMGdwh2YOr/XNq4+ITssKrcZMw+yoHJ1htyaPYhh
Sl0WA5H+q7iM2hU7Qs0jKGGvEDK1Bo6eaCPsnAjR081E8WxFcIsDA6rHuRuzcJ1A
9BO1mu5Tx0B/8kx0vNKYXmIly/a+hMdJX8k2/SWqoy/US9CEWq8=
=TMTU
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxUACgkQ4aewjAfp
7oZOKRAAvZ8ktOLXbfHw3SEB0hvngcNpfQwbpAy1LJL1DE3BvEWW5X5a7g4xaJGS
UMbBQ1+W5kbR4LNuxYt7WJ29N5jkKis/pw82UK2AS6l0wayecMYcvn5395WdHYZx
qzH22F3Y0n/cA5p9GDDD6bu7cis/tZkrLh5WHt1FWFe9SuGbQy8nNPr6pVda+pxy
e14uiEuP6+ocrkTKn0Wj/cKTIMO4ftYG0Zw9a1MdsQhWxZitM7BiT14DjXX7qGj6
LgoZ3mwNuY4K6HfcX7mhqG2byc5NYDLxSBT2jDuQXLBtfra0a+E56urFDtG19+jT
828pwyc3zD8JoCQ8h6TDYtjawBr72DCLYQjkbDKB8JqnH/cGHRtdGxHsaFZQunsM
DT3uly6+3/qd/KI3vEST12m+jKJI9VT8PxAX4vS/C1IZDevZSegb/kbWmXUT/CJf
LfqEeh7K0voJD6a8fX9RemV68pefgc3l8v3pYdSonBt5M2Oh5cSVGuz2gk09WZTE
a3cINVWbouI2Mzxq9aX+NjsEWJFWVao9xPn072Fg3+mG3RMhzYVnnr18C+qipwS0
IdumQgDO3vaW3GP6H9PYuvCL2HUjB+wpy6E6ww4NkeAtNgP/suYQBbbcdVS+kNAS
5q3aWGGEnThVBMtjzpljNjaB1dL68of4Lr9Q6MKKkSBt2og0Zy4=
=KA5g
-----END PGP SIGNATURE-----
+16
View File
@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxUACgkQ4aewjAfp
7oa/tg//f4A7W7rlZJBgx853rxABl4XuEAzU2UrkK2sstFvhjP4E7XmXpPdTCZcS
X3w20qrqKErRZe8ZsmgqV70rNTyCVOBcOM6TFGst0ax62+XY9y35bn9nXipEH31k
6GmxNsXw4AW8Qf9lsXIfmMuFOe35UovSAN0QLFqEtJFnIOT743Krl1XVuvaS8pU1
z3OpmSW4stwu4u9BcEMA530TYHyeRPn6qsH5MYcJ06WjDmSIAHAO6rROHYhlyD7d
vBVzW8o22jtY7L0eemnYxqndk/Xd1CkJgjeKFqEcmhNFXsyaHalN9aEfR2qRRrG4
AFrUw4DjrWtHSo5H9P7Vx51K48GFdt6hFOyRz5mPSTQWafAcB6Nnf+V4Mf5YKLrU
djRTepI2sRgxPVQiLcFk8gNlQwLMR7QnCg15j77Kr6jU8AuEPAA9XH8et9vz4Hc/
cw+qoQrlvFPeILLvbCA59Y6/Q++Si4MdunT93XwqYNr/kg9sGKCRDkA4dChmrV0F
hztSLWyKpOqPRgITzsD5Y57HiFUgnZ2ncYFPN1U/dY2Hw2VtyKrhNOqdQCMwyG0h
cjjGrSBrXZ15a88KKLTTTKJRDLgtpfd7n+f360GQQGwYjIHiT2uM5QPePdCgaemd
TTXYwnV1vs2HDKeq3poNHpGVff3rpmU9bjvZY0+v7o92Du0zdc8=
=Gyv6
-----END PGP SIGNATURE-----
Loaded 100 of 220 files, more files were not shown because too many files have changed in this diff. Show more