1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Change usage formatting

This commit is contained in:
Cameron Sparr
2015-12-11 14:35:57 -07:00
committed by Nicolas Williams
parent 6151f20477
commit 6d76cd0a99

View File

@ -49,30 +49,31 @@ static void usage(int code) {
int ret = fprintf(f,
"jq - commandline JSON processor [version %s]\n"
"Usage: %s [options] <jq filter> [file...]\n\n"
"\tjq is a tool for processing JSON inputs, applying the\n"
"\tgiven filter to its JSON text inputs and producing the\n"
"\tfilter's results as JSON on standard output.\n"
"\tThe simplest filter is ., which is the identity filter,\n"
"\tcopying jq's input to its output unmodified (except for\n"
"\tformatting).\n"
"\tFor more advanced filters see the jq(1) manpage (\"man jq\")\n"
"\tand/or https://stedolan.github.io/jq\n\n"
"\tSome of the options include:\n"
"\t -c\t\tcompact instead of pretty-printed output;\n"
"\t -n\t\tuse `null` as the single input value;\n"
"\t -e\t\tset the exit status code based on the output;\n"
"\t -s\t\tread (slurp) all inputs into an array; apply filter to it;\n"
"\t -r\t\toutput raw strings, not JSON texts;\n"
"\t -R\t\tread raw strings, not JSON texts;\n"
"\t -C\t\tcolorize JSON;\n"
"\t -M\t\tmonochrome (don't colorize JSON);\n"
"\t -S\t\tsort keys of objects on output;\n"
"\t --tab\tuse tabs for indentation;\n"
"\t --arg a v\tset variable $a to value <v>;\n"
"\t --argjson a v\tset variable $a to JSON value <v>;\n"
"\t --slurpfile a f\tset variable $a to an array of JSON texts read from <f>;\n"
"\tSee the manpage for more options.\n", JQ_VERSION, progname);
"\nUsage:\n\n\t%s [options] <jq filter> [file...]\n\n"
"jq is a tool for processing JSON inputs, applying the given filter to\n"
"its JSON text inputs and producing the filter's results as JSON on\n"
"standard output.\n\n"
"The simplest filter is ., which copies jq's input to its output\n"
"unmodified (except for formatting).\n\n"
"For more advanced filters see the jq(1) manpage (\"man jq\")\n"
"and/or https://stedolan.github.io/jq\n\n"
"Example:\n\n\t$ echo '{\"foo\": 0}' | jq .\n"
"\t{\n\t\t\"foo\": 0\n\t}\n\n"
"Some of the options include:\n"
" -c compact instead of pretty-printed output;\n"
" -n use `null` as the single input value;\n"
" -e set the exit status code based on the output;\n"
" -s read (slurp) all inputs into an array; apply filter to it;\n"
" -r output raw strings, not JSON texts;\n"
" -R read raw strings, not JSON texts;\n"
" -C colorize JSON;\n"
" -M monochrome (don't colorize JSON);\n"
" -S sort keys of objects on output;\n"
" --tab use tabs for indentation;\n"
" --arg a v set variable $a to value <v>;\n"
" --argjson a v set variable $a to JSON value <v>;\n"
" --slurpfile a f set variable $a to an array of JSON texts read from <f>;\n"
"\nSee the manpage for more options.\n", JQ_VERSION, progname);
exit((ret < 0 && code == 0) ? 2 : code);
}