Skip to content

Commit

Permalink
fix: Replace commander with hand-written command-line parser
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
prantlf committed Mar 5, 2023
1 parent 8ea195e commit af0ea29
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 137 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,39 @@ Usage: `jsonlint [options] [--] [<file, directory, pattern> ...]`
-f, --config <file> read options from a custom configuration file
-F, --no-config disable searching for configuration files
-s, --sort-keys sort object keys (not when prettifying)
-E, --extensions <ext...> file extensions to process for directory walk (default: ["json","JSON"])
-E, --extensions <ext...> file extensions to process for directory walk
(default: json, JSON)
-i, --in-place overwrite the input files
-j, --diff print difference instead of writing the output
-k, --check check that the input is equal to the output
-t, --indent <num|char> number of spaces or specific characters to use for indentation (default: 2)
-t, --indent <num|char> number of spaces or specific characters to use
for indentation or a string with whitespace
-c, --compact compact error display
-M, --mode <mode> set other parsing flags according to a format type (default: "json")
-M, --mode <mode> set other parsing flags according to the format
of the input data (default: json)
-B, --bom ignore the leading UTF-8 byte-order mark
-C, --comments recognize and ignore JavaScript-style comments
-S, --single-quoted-strings support single quotes as string delimiters
-T, --trailing-commas ignore trailing commas in objects and arrays
-D, --no-duplicate-keys report duplicate object keys as an error
-V, --validate <file...> JSON Schema file(s) to use for validation (default: [])
-e, --environment <env> which specification of JSON Schema the validation file uses
-x, --context <num> line count used as the diff context (default: 3)
-V, --validate <file...> JSON Schema file(s) to use for validation
-e, --environment <env> which version of JSON Schema the validation
should use
-x, --context <num> line number used as the diff context
(default: 3)
-l, --log-files print only the parsed file names to stdout
-q, --quiet do not print the parsed json to stdout
-n, --continue continue with other files if an error occurs
-p, --pretty-print prettify the input instead of stringifying the parsed object
-p, --pretty-print prettify the input instead of stringifying
the parsed object
-P, --pretty-print-invalid force pretty-printing even for invalid input
-r, --trailing-newline ensure a line break at the end of the output
-R, --no-trailing-newline ensure no line break at the end of the output
--prune-comments omit comments from the prettified output
--strip-object-keys strip quotes from object keys if possible (JSON5)
--strip-object-keys strip quotes from object keys if possible
--enforce-double-quotes surrounds all strings with double quotes
--enforce-single-quotes surrounds all strings with single quotes (JSON5)
--trim-trailing-commas omit trailing commas from objects and arrays (JSON5)
--enforce-single-quotes surrounds all strings with single quotes
--trim-trailing-commas omit trailing commas from objects and arrays
-v, --version output the version number
-h, --help display help for command

Expand Down
Loading

0 comments on commit af0ea29

Please sign in to comment.