jq icon indicating copy to clipboard operation
jq copied to clipboard

--rawfile not mentioned in man page jq(1) for jq-1.6, but under --help and in the online manual

Open bfrg opened this issue 6 years ago • 6 comments

Describe the bug The option --rawfile is mentioned under jq --help as well as in the online manual but not in the man page jq(1).

To Reproduce

$ cd /path/to/jq/repo
$ git checkout jq-1.6
$ ./configure
$ make -j4

Now check man ./jq.1 and ./jq --help.

Expected behavior The --rawfile option should be mentioned in jq(1) just like in the online manual.

Environment

  • OS and Version: Gentoo Linux
  • jq version 1.6

bfrg avatar Oct 28 '19 13:10 bfrg

hi @bfrg I used the command "jq --help", the parameter `` --rawfile '' was mentioned in the prompt message。you can try it. version :master

jq - commandline JSON processor [version -]

Usage:  test_coverage/jq [options] <jq filter> [file...]
        test_coverage/jq [options] --args <jq filter> [strings...]
        test_coverage/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[].

Alanscut avatar Dec 19 '19 11:12 Alanscut

Yes it is mentioned in jq --help (and also in the online manual), but it is not mentioned in man jq.

bfrg avatar Dec 19 '19 12:12 bfrg

Hmm? If it's in the online manual, it's in the man page too -- it's the same source for both. Indeed, I see it there. Ah..., it's not in jq.1.prebuilt, and if you don't have the right dependencies installed, you don't get a proper jq.1. We should have updated jq.1.prebuilt for the 1.6 release, but we didn't. Hopefully we won't forget when we release 1.7.

nicowilliams avatar Dec 30 '19 06:12 nicowilliams

is this issue fixed right now? because it doesn't seem to be working

jcho0216 avatar Dec 06 '21 00:12 jcho0216

I am also getting the below error: jq: Unknown option --rawfile Use jq --help for help with command-line options, or see the jq manpage, or online docs at https://stedolan.github.io/jq

pawan-soobhri avatar May 09 '22 17:05 pawan-soobhri

@pawan-soobhri that probably just means that you are running an older version of jq (probably 1.5).

the current version of jq (1.6; released ~4 years ago) would output:

bash-5.1$ jq --rawfile
jq: --rawfile takes two parameters (e.g. --rawfile varname filename)
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq

You can check what version you are running using jq --version:

bash-5.1$ jq --version
jq-1.6

emanuele6 avatar May 09 '22 23:05 emanuele6