Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 9afda0a
Merge: 4665e81 eeb08b5
Author: pkoppstein <[email protected]>
Date:   Mon Jul 31 07:33:58 2023 -0400

    Merge branch 'walk' of https://github.com/pkoppstein/jq into walk

commit 4665e81
Author: pkoppstein <[email protected]>
Date:   Mon Jul 31 07:26:03 2023 -0400

    revamp walk/1: rebase, add test cases

    Note that according to the new def:

    `{x:0} | walk(.,1)` is equivalent to: {x:0} | walk(.), walk(1)

commit bdec9c0
Author: pkoppstein <[email protected]>
Date:   Wed Jul 5 02:00:59 2023 -0400

    revamp walk/1

    Resolves jqlang#2584; see also jqlang#2611

commit c8e28da
Author: itchyny <[email protected]>
Date:   Mon Jul 31 09:52:52 2023 +0900

    Redesign website (jqlang#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.

commit 4af3f99
Author: Owen Ou <[email protected]>
Date:   Sat Jul 29 07:20:48 2023 -0700

    Update `bug_report.md` with Discord link

commit 82f7f77
Author: Owen Ou <[email protected]>
Date:   Sat Jul 29 07:15:57 2023 -0700

    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.

commit f733a15
Author: Nicolas Williams <[email protected]>
Date:   Mon Jul 10 18:29:03 2023 -0500

    Use -Wno-cast-function-type to quiet many warnings

commit c8b30df
Author: Nicolas Williams <[email protected]>
Date:   Mon Jul 10 18:28:33 2023 -0500

    Add JQ_FALLTHROUGH and use it to quiet warnings

commit a6eb055
Author: Emanuele Torre <[email protected]>
Date:   Sat Jul 29 21:57:40 2023 +0200

    Fix typo in manual: "-seq" => "--seq"

commit ee2a215
Author: Owen Ou <[email protected]>
Date:   Sat Jul 29 07:38:08 2023 -0700

    Backfill with references in NEWS.md (jqlang#2788)

    Backfill with references to PRs & issues in NEWS.md

commit eeb08b5
Author: pkoppstein <[email protected]>
Date:   Wed Jul 5 02:00:59 2023 -0400

    revamp walk/1

    Resolves jqlang#2584; see also jqlang#2611
  • Loading branch information
pkoppstein committed Jul 31, 2023
1 parent 70bbd10 commit 174fd86
Show file tree
Hide file tree
Showing 36 changed files with 576 additions and 766 deletions.
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (https://web.libera.chat/#jq) on Libera.Chat (https://libera.chat/).
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).
-->

Expand All @@ -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.
2 changes: 1 addition & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
cache: pipenv
- name: Install pipenv
run: pip install pipenv
Expand Down
9 changes: 3 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
### C build options

AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
-Wno-unused-parameter -Wno-unused-function
-Wno-unused-parameter -Wno-unused-function \
-Wno-cast-function-type

if WIN32
AM_CFLAGS += -municode
Expand Down Expand Up @@ -196,14 +197,10 @@ endif

### Packaging

docs/site.yml: configure.ac
sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new
mv $@.new $@

install-binaries: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-exec

DOC_FILES = docs/content docs/public docs/templates docs/site.yml \
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
Expand Down
181 changes: 102 additions & 79 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,39 @@ After a five year hiatus we're back with a GitHub organization, with new admins

Since the last stable release many things have happened:

- jq now lives at https://github.com/jqlang
- jq now lives at <https://github.com/jqlang>
- New maintainers, admins, and owners have been recruited.
- CI, scan builds, release builds etc now use GitHub actions.
- A list of [current maintainers](https://github.com/jqlang/jq/blob/70bbd10b0b58e797d03963264fc934879bb44454/AUTHORS#L4-L13)
- CI, scan builds, release builds etc now use GitHub actions. @owenthereal #2596 #2620
- Lots of documentation improvements and fixes.
- Web site updated with new auto complete, 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`
- Docker images are now available from `ghcr.io/jqlang/jq` instead of docker hub.
- OSS-fuzz.
- More details see @owenthereal #2665
- Docker images are now available from `ghcr.io/jqlang/jq` instead of docker hub. @itchyny #2652
- 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:
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" yellow (33, the last value)
$ JQ_COLORS="1;30:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}'
{
"field": 123
}
```
- Respect `NO_COLOR` environment variable to disable color output. See https://no-color.org for details. @itchyny #2728

- 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 #2747 #2766
- Last output value can now control exit code using `--exit-code`/`-e`. @ryo1kato #1697

```sh
# true-ish last output value exits with zero
$ jq -ne true ; echo $?
Expand All @@ -45,8 +50,10 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
$ jq -ne empty ; echo $?
4
```

- Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. 0dab2b1 @nicowilliams
- 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
Expand All @@ -69,12 +76,14 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
$ 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

## 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
$ jq -n '100000000000000000'
Expand All @@ -86,7 +95,9 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
$ jq -n '100000000000000000+10'
100000000000000020
```

- Adds new builtin `pick(stream)` to emit a projection of the input object or array. @pkoppstein #2656

```sh
$ jq -n '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4} | pick(.a, .b.c, .x)'
{
Expand All @@ -97,7 +108,9 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
"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"]
Expand All @@ -111,15 +124,19 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
"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'
Expand All @@ -135,7 +152,9 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
"two"
3
```
- Allow use of `$binding` as key in object literals. 8ea4a55 @nicowilliams
```sh
$ jq -n '"a" as $key | {$key: 123}'
{
Expand All @@ -147,26 +166,31 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
"a": 123
}
```
- Allow dot between chained indexes when using `.["index"]` @nicowilliams #1168
```sh
$ jq -n '{"a": {"b": 123}} | .a["b"]'
123
# now this works also
$ jq -n '{"a": {"b": 123}} | .a.["b"]'
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
- Make 0 divided by 0 result in NaN consistently. @itchyny #2253
- 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]
```
- 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
Expand All @@ -181,113 +205,112 @@ Full commit log can be found at https://github.com/jqlang/jq/compare/jq-1.6...jq
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
- 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
- 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!
- 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
- Add support for ASAN and UBSAN
- Make it easier to use jq with shebangs (8f6f28c)
- Make it easier to use jq with shebangs (8f6f28c)
- Add $ENV builtin variable to access environment
- Add $ENV builtin variable to access environment
- Add JQ_COLORS env var for configuring the output colors
- Add JQ_COLORS env var for configuring the output colors
New features in 1.5 since 1.4:
- regular expressions (with Oniguruma)
- regular expressions (with Oniguruma)
- a library/module system
- a library/module system
- many new builtins
- 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`)
- 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:
- 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
- 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
- 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
- --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:
- optimizations:
- tail-call optimization
- reduce and foreach no longer leak a reference to .
- tail-call optimization
- reduce and foreach no longer leak a reference to .
New features in 1.4 since 1.3:
- command-line arguments
- 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
- 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
- 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)
- .. -> 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:
- filters:
- any, all
- iterables, arrays, objects, scalars, nulls, booleans, numbers,
- any, all
- iterables, arrays, objects, scalars, nulls, booleans, numbers,
strings, values
- string built-ins:
- 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
- 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
- math functions
- floor, sqrt, cbrt, etcetera (depends on what's available from libm)
- floor, sqrt, cbrt, etcetera (depends on what's available from libm)
- libjq -- a C API interface to jq's JSON representation and for
- libjq -- a C API interface to jq's JSON representation and for
running jq programs from C applications
Loading

0 comments on commit 174fd86

Please sign in to comment.