On Fri, Oct 04, 2019 at 01:44:10PM +0200, Klemens Nanni wrote:
> rsadowski noted that DESCR is too lenghty and upon second read I agree
> that my shameless dump of the project's README is too much.
> 
> Nonetheless I'd like to provide more information than
> 
>       yq is a command line processor for Yaml/Xml documents,
>       similar to jq for Json.
> 
> for the user's convenience, so here's a second attempt that reduces
> DESCR into what I think is still relevant;  no other changes in the new
> tarball except a whitespace fix in Makefile.
> 
> Information for inst:yq-2.7.2
> 
> Comment:
> jq wrapper for YAML/XML documents
> 
> Description:
> yq takes YAML input, converts it to JSON, and filters it through jq(1).
> 
> No output conversion is done by default.  Command line arguments are 
> forwarded.
> yq exits 1 on YAML parsing errors, otherwise jq's exit code is forwarded.
> 
> YAML tags in the input are ignored (any nested data is treated as untagged).
> Key order is preserved.
> 
> xq behaves like yq but takes XML input.  Multiple XML documents can be passed
> in separate files/streams.  Entity expansion and DTD resolution is disabled to
> avoid XML parsing vulnerabilities.
> 
> Maintainer: Klemens Nanni <k...@openbsd.org>
> 
> WWW: https://yq.readthedocs.io/
kmos reported different (failing?) test results but I could not
reproduce any of it;  see attached the same tarball again as well as my
test.log.

Feedback?

Attachment: yq.tgz
Description: Binary data

/usr/local/bin/python3.7 /usr/ports/pobj/yq-2.7.2/yq-2.7.2/test/test.py
.[
  "2016-12-20T22:07:36"
]
"2016-12-20"
.{}
..40333
x{}
."bar"
.{
  "foo": null
}
..jq - commandline JSON processor [version 1.6]

Usage:  jq [options] <jq filter> [file...]
        jq [options] --args <jq filter> [strings...]
        jq [options] --jsonargs <jq filter> [JSON_TEXTS...]

jq is a tool for processing JSON inputs, applying the given filter to
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

Example:

        $ echo '{"foo": 0}' | jq .
        {
                "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 <v>;
  --argjson a v    set variable $a to JSON value <v>;
  --slurpfile a f  set variable $a to an array of JSON texts read from <f>;
  --rawfile a f    set variable $a to a string consisting of the contents of 
<f>;
  --args           remaining arguments are string arguments, not files;
  --jsonargs       remaining arguments are JSON arguments, not files;
  --               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.
jq - commandline JSON processor [version 1.6]

Usage:  jq [options] <jq filter> [file...]
        jq [options] --args <jq filter> [strings...]
        jq [options] --jsonargs <jq filter> [JSON_TEXTS...]

jq is a tool for processing JSON inputs, applying the given filter to
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

Example:

        $ echo '{"foo": 0}' | jq .
        {
                "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 <v>;
  --argjson a v    set variable $a to JSON value <v>;
  --slurpfile a f  set variable $a to an array of JSON texts read from <f>;
  --rawfile a f    set variable $a to a string consisting of the contents of 
<f>;
  --args           remaining arguments are string arguments, not files;
  --jsonargs       remaining arguments are JSON arguments, not files;
  --               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.
jq - commandline JSON processor [version 1.6]

Usage:  jq [options] <jq filter> [file...]
        jq [options] --args <jq filter> [strings...]
        jq [options] --jsonargs <jq filter> [JSON_TEXTS...]

jq is a tool for processing JSON inputs, applying the given filter to
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

Example:

        $ echo '{"foo": 0}' | jq .
        {
                "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 <v>;
  --argjson a v    set variable $a to JSON value <v>;
  --slurpfile a f  set variable $a to an array of JSON texts read from <f>;
  --rawfile a f    set variable $a to a string consisting of the contents of 
<f>;
  --args           remaining arguments are string arguments, not files;
  --jsonargs       remaining arguments are JSON arguments, not files;
  --               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.
{}
3
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
/usr/local/lib/python3.7/subprocess.py:883: ResourceWarning: subprocess 65871 
is still running
  ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./usr/local/lib/python3.7/subprocess.py:883: ResourceWarning: subprocess 99593 
is still running
  ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.
----------------------------------------------------------------------
Ran 12 tests in 4.395s

OK (expected failures=1)
usage: yq [options] <jq filter> [YAML file...]
          jq_filter [files [files ...]]

yq: Command-line YAML processor - jq wrapper for YAML documents

yq transcodes YAML documents to JSON and passes them to jq.
See https://github.com/kislyuk/yq for more information.

positional arguments:
  jq_filter
  files

optional arguments:
  -h, --help            show this help message and exit
  --yaml-output, --yml-output, -y
                        Transcode jq JSON output back into YAML and emit it
  --width WIDTH, -w WIDTH
                        When using --yaml-output, specify string wrap width
  --version             show program's version number and exit

usage: yq [options] <jq filter> [YAML file...]
          jq_filter [files [files ...]]

yq: Command-line YAML processor - jq wrapper for YAML documents

yq transcodes YAML documents to JSON and passes them to jq.
See https://github.com/kislyuk/yq for more information.

positional arguments:
  jq_filter
  files

optional arguments:
  -h, --help            show this help message and exit
  --yaml-output, --yml-output, -y
                        Transcode jq JSON output back into YAML and emit it
  --width WIDTH, -w WIDTH
                        When using --yaml-output, specify string wrap width
  --version             show program's version number and exit

usage: yq [options] <jq filter> [YAML file...]
          jq_filter [files [files ...]]

yq: Command-line YAML processor - jq wrapper for YAML documents

yq transcodes YAML documents to JSON and passes them to jq.
See https://github.com/kislyuk/yq for more information.

positional arguments:
  jq_filter
  files

optional arguments:
  -h, --help            show this help message and exit
  --yaml-output, --yml-output, -y
                        Transcode jq JSON output back into YAML and emit it
  --width WIDTH, -w WIDTH
                        When using --yaml-output, specify string wrap width
  --version             show program's version number and exit

sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=4 
encoding='UTF-8'>

Reply via email to