Skip to content

Commit af0ea29

Browse files
committed
fix: Replace commander with hand-written command-line parser
Commander accepts a space as delimited of multiple values for an option. It makes unclear what option the values belong to and forces "--" to be inserted before the first argument following the option values. BREAKING CHANGE: Although you shouldn't notice any change on the behaviour of the command line, something unexpected might've changed. Something did change - if you're annoyed by inserting "--" between the multi-value option and other arguments, you don't have to do it any more. Multi-value options can be entered either using the option prefix multiple times for each value, or using the option prefix just once and separating the values by commas.
1 parent 8ea195e commit af0ea29

File tree

4 files changed

+284
-137
lines changed

4 files changed

+284
-137
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,33 +121,39 @@ Usage: `jsonlint [options] [--] [<file, directory, pattern> ...]`
121121
-f, --config <file> read options from a custom configuration file
122122
-F, --no-config disable searching for configuration files
123123
-s, --sort-keys sort object keys (not when prettifying)
124-
-E, --extensions <ext...> file extensions to process for directory walk (default: ["json","JSON"])
124+
-E, --extensions <ext...> file extensions to process for directory walk
125+
(default: json, JSON)
125126
-i, --in-place overwrite the input files
126127
-j, --diff print difference instead of writing the output
127128
-k, --check check that the input is equal to the output
128-
-t, --indent <num|char> number of spaces or specific characters to use for indentation (default: 2)
129+
-t, --indent <num|char> number of spaces or specific characters to use
130+
for indentation or a string with whitespace
129131
-c, --compact compact error display
130-
-M, --mode <mode> set other parsing flags according to a format type (default: "json")
132+
-M, --mode <mode> set other parsing flags according to the format
133+
of the input data (default: json)
131134
-B, --bom ignore the leading UTF-8 byte-order mark
132135
-C, --comments recognize and ignore JavaScript-style comments
133136
-S, --single-quoted-strings support single quotes as string delimiters
134137
-T, --trailing-commas ignore trailing commas in objects and arrays
135138
-D, --no-duplicate-keys report duplicate object keys as an error
136-
-V, --validate <file...> JSON Schema file(s) to use for validation (default: [])
137-
-e, --environment <env> which specification of JSON Schema the validation file uses
138-
-x, --context <num> line count used as the diff context (default: 3)
139+
-V, --validate <file...> JSON Schema file(s) to use for validation
140+
-e, --environment <env> which version of JSON Schema the validation
141+
should use
142+
-x, --context <num> line number used as the diff context
143+
(default: 3)
139144
-l, --log-files print only the parsed file names to stdout
140145
-q, --quiet do not print the parsed json to stdout
141146
-n, --continue continue with other files if an error occurs
142-
-p, --pretty-print prettify the input instead of stringifying the parsed object
147+
-p, --pretty-print prettify the input instead of stringifying
148+
the parsed object
143149
-P, --pretty-print-invalid force pretty-printing even for invalid input
144150
-r, --trailing-newline ensure a line break at the end of the output
145151
-R, --no-trailing-newline ensure no line break at the end of the output
146152
--prune-comments omit comments from the prettified output
147-
--strip-object-keys strip quotes from object keys if possible (JSON5)
153+
--strip-object-keys strip quotes from object keys if possible
148154
--enforce-double-quotes surrounds all strings with double quotes
149-
--enforce-single-quotes surrounds all strings with single quotes (JSON5)
150-
--trim-trailing-commas omit trailing commas from objects and arrays (JSON5)
155+
--enforce-single-quotes surrounds all strings with single quotes
156+
--trim-trailing-commas omit trailing commas from objects and arrays
151157
-v, --version output the version number
152158
-h, --help display help for command
153159

0 commit comments

Comments
 (0)