From 8cc32aea7b01a52faa10bd117edf0f7bb1e12233 Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Fri, 2 Jun 2023 16:47:02 +0200 Subject: [PATCH] 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 --- NEWS | 113 -------------- NEWS.md | 213 ++++++++++++++++++++++++++ docs/templates/shared/_navbar.html.j2 | 2 +- 3 files changed, 214 insertions(+), 114 deletions(-) delete mode 100644 NEWS create mode 100644 NEWS.md diff --git a/NEWS b/NEWS deleted file mode 100644 index 11331f6f03..0000000000 --- a/NEWS +++ /dev/null @@ -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, 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 - diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000000..5dfe0d6c7b --- /dev/null +++ b/NEWS.md @@ -0,0 +1,213 @@ +# 1.x + +TODO: +- Word about new organization and repo move? +- Docker images +- scan/2 added +- sub/3 fixes +- validate module metadata is object +- Fix number lexer to avoid conflict with object indexing (#2254) +- lots of docs fixes + +Changes + +- Use decimal number literals to preserve precision. Comparison operations respects precision but arithmetic operations might truncate. #1752 @leonid-s-usov + ```sh + # precision is preserved + $ jq -n '100000000000000000' + 100000000000000000 + # comparsion respects precision (this is false in JavaScript) + $ jq -n '100000000000000000 < 100000000000000001' + true + # arithmetic operations might truncate (same as JavaScript) + $ jq -n '100000000000000000+10' + 100000000000000020 + ``` +- Allow `if` without `else`-branch. When skipped the `else`-branch will be `.` (identity). #1825 @chancez #2481 @wader + ```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. 8ea4a55 @nicowilliams + ```sh + $ jq -n '"a" as $key | {$key: 123}' + { + "a": 123 + } + # previously parentheses were needed + $ jq -n '"a" as $key | {($key): 123}' + { + "a": 123 + } + ``` +- Last output value can now control exit code using `--exit-code`/`-e`. #1697 @ryo1kato + ```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 + ``` +- Allow dot between chained indexes when using `.["index"]` #1168 @nicowilliams + ```sh + $ jq -n '{"a": {"b": 123}} | .a["b"]' + 123 + # now this works also + $ jq -n '{"a": {"b": 123}} | .a.["b"]' + 123 + ``` +- Speed up and refactor some builtins, also remove `scalars_or_empty/0`. #1845 @muhmuhten +- Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. 0dab2b1 @nicowilliams +- Add `--nul-output`/`-0` for null (zero byte) separated output. #1990 @pabs3, #2235 @asottile + ```sh + # will output a zero byte after each output + $ jq -n0 '1,2,3' | xxd + 00000000: 3100 3200 3300 1.2.3. + # can be used with xargs -0 + $ jq -n -0 '"a","b","c"' | xargs -0 -n1 + a + b + c + $ jq -n -0 '"a b c", "d\ne\nf"' | xargs -0 printf '%q\n' + 'a b c' + 'd'$'\n''e'$'\n''f' + # can be used with read -d '' + $ while IFS= read -r -d '' json; do + > jq '.name' <<< "$json" + > done < <(jq -n -0 '{name:"a b c"},{name:"d\ne\nf"}') + "a b c" + "d\ne\nf" + ``` +- Fix issue converting string to number after previous convert error. #2400 @thalman + +# 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, 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 + diff --git a/docs/templates/shared/_navbar.html.j2 b/docs/templates/shared/_navbar.html.j2 index a3adb3ad42..a3238611e7 100644 --- a/docs/templates/shared/_navbar.html.j2 +++ b/docs/templates/shared/_navbar.html.j2 @@ -20,7 +20,7 @@
  • Issues
  • Source
  • Try online!
  • -
  • News
  • +
  • News