From a767f35373a389bcb77f3cac99dfe7012302c3fd Mon Sep 17 00:00:00 2001 From: Andrey Kislyuk Date: Sat, 13 Apr 2024 22:26:20 -0700 Subject: [PATCH] v3.3.0 --- Changes.rst | 10 ++++++ docs/cli-doc-tomlq.txt | 69 ++++++++++++++++++++++++--------------- docs/cli-doc-xq.txt | 74 +++++++++++++++++++++++++----------------- docs/cli-doc.txt | 74 ++++++++++++++++++++++++------------------ setup.py | 2 +- 5 files changed, 140 insertions(+), 89 deletions(-) diff --git a/Changes.rst b/Changes.rst index 0e8bfa8..689e987 100644 --- a/Changes.rst +++ b/Changes.rst @@ -1,3 +1,13 @@ +Changes for v3.3.0 (2024-04-13) +=============================== + +- tomlq: Use tomllib on Python 3.11 when not round-tripping + +- xq: Support in-place XML editing + +- Do not interpret characters that cannot be parsed in octal as int + (#176) + Changes for v3.2.3 (2023-09-09) =============================== diff --git a/docs/cli-doc-tomlq.txt b/docs/cli-doc-tomlq.txt index 7c29e19..8fdd48f 100644 --- a/docs/cli-doc-tomlq.txt +++ b/docs/cli-doc-tomlq.txt @@ -15,7 +15,7 @@ options: --in-place, -i Edit files in place (no backup - use caution) --version show program's version number and exit -jq - commandline JSON processor [version 1.6] +jq - commandline JSON processor [version 1.7] Usage: jq [options] [file...] jq [options] --args [strings...] @@ -26,39 +26,54 @@ its JSON text inputs and producing the filter's results as JSON on standard output. The simplest filter is ., which copies jq's input to its output -unmodified (except for formatting, but note that IEEE754 is used -for number representation internally, with all that that implies). - -For more advanced filters see the jq(1) manpage ("man jq") -and/or https://stedolan.github.io/jq +unmodified except for formatting. For more advanced filters see +the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/. Example: $ echo '{"foo": 0}' | jq . { - "foo": 0 + "foo": 0 } -Some of the options include: - -c compact instead of pretty-printed output; - -n use `null` as the single input value; - -e set the exit status code based on the output; - -s read (slurp) all inputs into an array; apply filter to it; - -r output raw strings, not JSON texts; - -R read raw strings, not JSON texts; - -C colorize JSON; - -M monochrome (don't colorize JSON); - -S sort keys of objects on output; - --tab use tabs for indentation; - --arg a v set variable $a to value ; - --argjson a v set variable $a to JSON value ; - --slurpfile a f set variable $a to an array of JSON texts read from ; - --rawfile a f set variable $a to a string consisting of the contents of ; - --args remaining arguments are string arguments, not files; - --jsonargs remaining arguments are JSON arguments, not files; - -- terminates argument processing; +Command options: + -n, --null-input use `null` as the single input value; + -R, --raw-input read each line as string instead of JSON; + -s, --slurp read all inputs into an array and use it as + the single input value; + -c, --compact-output compact instead of pretty-printed output; + -r, --raw-output output strings without escapes and quotes; + --raw-output0 implies -r and output NUL after each output; + -j, --join-output implies -r and output without newline after + each output; + -a, --ascii-output output strings by only ASCII characters + using escape sequences; + -S, --sort-keys sort keys of each object on output; + -C, --color-output colorize JSON output; + -M, --monochrome-output disable colored output; + --tab use tabs for indentation; + --indent n use n spaces for indentation (max 7 spaces); + --unbuffered flush output stream after each output; + --stream parse the input value in streaming fashion; + --stream-errors implies --stream and report parse error as + an array; + --seq parse input/output as application/json-seq; + -f, --from-file file load filter from the file; + -L directory search modules from the directory; + --arg name value set $name to the string value; + --argjson name value set $name to the JSON value; + --slurpfile name file set $name to an array of JSON values read + from the file; + --rawfile name file set $name to string contents of file; + --args consume remaining arguments as positional + string values; + --jsonargs consume remaining arguments as positional + JSON values; + -e, --exit-status set exit status code based on the output; + -V, --version show the version; + --build-configuration show jq's build configuration; + -h, --help show the help; + -- terminates argument processing; Named arguments are also available as $ARGS.named[], while positional arguments are available as $ARGS.positional[]. - -See the manpage for more options. diff --git a/docs/cli-doc-xq.txt b/docs/cli-doc-xq.txt index 396594a..8a7900c 100644 --- a/docs/cli-doc-xq.txt +++ b/docs/cli-doc-xq.txt @@ -1,5 +1,4 @@ usage: xq [options] [input file...] - [--version] [jq_filter] [files ...] xq: Command-line XML processor - jq wrapper for XML documents @@ -14,14 +13,14 @@ positional arguments: options: -h, --help show this help message and exit --xml-output, -x Transcode jq JSON output back into XML and emit it - --xml-item-depth 123 Specify depth of items to emit (default 0; use a positive integer to stream large docs) --xml-dtd Preserve XML Document Type Definition (disables streaming of multiple docs) --xml-root XML_ROOT When transcoding back to XML, envelope the output in an element with this name - --xml-force-list ELT Emit a list for elements with this name even if they occur only once (option can repeat) + --xml-force-list XML_FORCE_LIST + Tag name to pass to force_list parameter of xmltodict.parse(). Can be used multiple times. --in-place, -i Edit files in place (no backup - use caution) --version show program's version number and exit -jq - commandline JSON processor [version 1.6] +jq - commandline JSON processor [version 1.7] Usage: jq [options] [file...] jq [options] --args [strings...] @@ -32,39 +31,54 @@ its JSON text inputs and producing the filter's results as JSON on standard output. The simplest filter is ., which copies jq's input to its output -unmodified (except for formatting, but note that IEEE754 is used -for number representation internally, with all that that implies). - -For more advanced filters see the jq(1) manpage ("man jq") -and/or https://stedolan.github.io/jq +unmodified except for formatting. For more advanced filters see +the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/. Example: $ echo '{"foo": 0}' | jq . { - "foo": 0 + "foo": 0 } -Some of the options include: - -c compact instead of pretty-printed output; - -n use `null` as the single input value; - -e set the exit status code based on the output; - -s read (slurp) all inputs into an array; apply filter to it; - -r output raw strings, not JSON texts; - -R read raw strings, not JSON texts; - -C colorize JSON; - -M monochrome (don't colorize JSON); - -S sort keys of objects on output; - --tab use tabs for indentation; - --arg a v set variable $a to value ; - --argjson a v set variable $a to JSON value ; - --slurpfile a f set variable $a to an array of JSON texts read from ; - --rawfile a f set variable $a to a string consisting of the contents of ; - --args remaining arguments are string arguments, not files; - --jsonargs remaining arguments are JSON arguments, not files; - -- terminates argument processing; +Command options: + -n, --null-input use `null` as the single input value; + -R, --raw-input read each line as string instead of JSON; + -s, --slurp read all inputs into an array and use it as + the single input value; + -c, --compact-output compact instead of pretty-printed output; + -r, --raw-output output strings without escapes and quotes; + --raw-output0 implies -r and output NUL after each output; + -j, --join-output implies -r and output without newline after + each output; + -a, --ascii-output output strings by only ASCII characters + using escape sequences; + -S, --sort-keys sort keys of each object on output; + -C, --color-output colorize JSON output; + -M, --monochrome-output disable colored output; + --tab use tabs for indentation; + --indent n use n spaces for indentation (max 7 spaces); + --unbuffered flush output stream after each output; + --stream parse the input value in streaming fashion; + --stream-errors implies --stream and report parse error as + an array; + --seq parse input/output as application/json-seq; + -f, --from-file file load filter from the file; + -L directory search modules from the directory; + --arg name value set $name to the string value; + --argjson name value set $name to the JSON value; + --slurpfile name file set $name to an array of JSON values read + from the file; + --rawfile name file set $name to string contents of file; + --args consume remaining arguments as positional + string values; + --jsonargs consume remaining arguments as positional + JSON values; + -e, --exit-status set exit status code based on the output; + -V, --version show the version; + --build-configuration show jq's build configuration; + -h, --help show the help; + -- terminates argument processing; Named arguments are also available as $ARGS.named[], while positional arguments are available as $ARGS.positional[]. - -See the manpage for more options. diff --git a/docs/cli-doc.txt b/docs/cli-doc.txt index 8880e75..0d20fa5 100644 --- a/docs/cli-doc.txt +++ b/docs/cli-doc.txt @@ -1,6 +1,5 @@ usage: yq [options] [input file...] - [--indentless-lists] [--explicit-start] [--explicit-end] - [--in-place] [--version] + [--indentless-lists] [--in-place] [--version] [jq_filter] [files ...] yq: Command-line YAML processor - jq wrapper for YAML documents @@ -24,12 +23,10 @@ options: When using --yaml-output, specify string wrap width --indentless-lists, --indentless When using --yaml-output, indent block style lists (sequences) with 0 spaces instead of 2 - --explicit-start When using --yaml-output, always emit explicit document start ("---") - --explicit-end When using --yaml-output, always emit explicit document end ("...") --in-place, -i Edit files in place (no backup - use caution) --version show program's version number and exit -jq - commandline JSON processor [version 1.6] +jq - commandline JSON processor [version 1.7] Usage: jq [options] [file...] jq [options] --args [strings...] @@ -40,39 +37,54 @@ its JSON text inputs and producing the filter's results as JSON on standard output. The simplest filter is ., which copies jq's input to its output -unmodified (except for formatting, but note that IEEE754 is used -for number representation internally, with all that that implies). - -For more advanced filters see the jq(1) manpage ("man jq") -and/or https://stedolan.github.io/jq +unmodified except for formatting. For more advanced filters see +the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/. Example: $ echo '{"foo": 0}' | jq . { - "foo": 0 + "foo": 0 } -Some of the options include: - -c compact instead of pretty-printed output; - -n use `null` as the single input value; - -e set the exit status code based on the output; - -s read (slurp) all inputs into an array; apply filter to it; - -r output raw strings, not JSON texts; - -R read raw strings, not JSON texts; - -C colorize JSON; - -M monochrome (don't colorize JSON); - -S sort keys of objects on output; - --tab use tabs for indentation; - --arg a v set variable $a to value ; - --argjson a v set variable $a to JSON value ; - --slurpfile a f set variable $a to an array of JSON texts read from ; - --rawfile a f set variable $a to a string consisting of the contents of ; - --args remaining arguments are string arguments, not files; - --jsonargs remaining arguments are JSON arguments, not files; - -- terminates argument processing; +Command options: + -n, --null-input use `null` as the single input value; + -R, --raw-input read each line as string instead of JSON; + -s, --slurp read all inputs into an array and use it as + the single input value; + -c, --compact-output compact instead of pretty-printed output; + -r, --raw-output output strings without escapes and quotes; + --raw-output0 implies -r and output NUL after each output; + -j, --join-output implies -r and output without newline after + each output; + -a, --ascii-output output strings by only ASCII characters + using escape sequences; + -S, --sort-keys sort keys of each object on output; + -C, --color-output colorize JSON output; + -M, --monochrome-output disable colored output; + --tab use tabs for indentation; + --indent n use n spaces for indentation (max 7 spaces); + --unbuffered flush output stream after each output; + --stream parse the input value in streaming fashion; + --stream-errors implies --stream and report parse error as + an array; + --seq parse input/output as application/json-seq; + -f, --from-file file load filter from the file; + -L directory search modules from the directory; + --arg name value set $name to the string value; + --argjson name value set $name to the JSON value; + --slurpfile name file set $name to an array of JSON values read + from the file; + --rawfile name file set $name to string contents of file; + --args consume remaining arguments as positional + string values; + --jsonargs consume remaining arguments as positional + JSON values; + -e, --exit-status set exit status code based on the output; + -V, --version show the version; + --build-configuration show jq's build configuration; + -h, --help show the help; + -- terminates argument processing; Named arguments are also available as $ARGS.named[], while positional arguments are available as $ARGS.positional[]. - -See the manpage for more options. diff --git a/setup.py b/setup.py index 369153d..586f9ab 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="yq", - version="3.2.3", + version="3.3.0", url="https://github.com/kislyuk/yq", license="Apache Software License", author="Andrey Kislyuk",