This PR refactors some of the CLI related logic. Uses Clap's ValueEnum instead of manually handling the enums as strings as throwing errors and all that - this makes the code more readable, and improves the help text.
Before:
Options:
-c, --color-mode <COLOR_MODE> specify color mode (options: ["always", "compatibility", "never"])
-d, --display-mode <DISPLAY_MODE> specify display format (options: ["standard", "standard-alphabetical", "json", "classic", "default"])
--dry-run display finalized config options and exit (merged options from an optional config file and command line arguments)
-i, --ignore-config-file ignore config file settings
-h, --help Print help
-V, --version Print version
After:
Options:
-c, --color-mode <COLOR_MODE>
Possible values:
- always: Attempt to display colors as intended (default behavior)
- compatibility: Display colors using widely-compatible methods at the potential expense of colors being displayed as intended
- never: Never display colors
-d, --display-mode <DISPLAY_MODE>
Possible values:
- classic: Informs the caller to display results in the classic format
- json: Informs the caller to display results in JSON format
- standard: Informs the caller to display results in the standard (default) format. All results are sorted alphabetically and then sorted by status
- standard-alphabetical: Informs the caller to display results in the standard (default) format with a twist: all results are solely sorted alphabetically (i.e. no additional sort by status)
--dry-run
display finalized config options and exit (merged options from an optional config file and command line arguments)
-i, --ignore-config-file
ignore config file settings
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
We could possibly improve this a little bit further by using #[clap(default...)] (https://docs.rs/clap/latest/clap/_derive/index.html#arg-attributes) and have Clap fancily format the ValueEnum options into showing the defaults, but that gets complicated with the config file. Maybe another time :D
This PR also removes multiple instances of match on boolean values, replacing them with if, and resolves several other Clippy suggestions/fixes.
This PR refactors some of the CLI related logic. Uses Clap's ValueEnum instead of manually handling the enums as strings as throwing errors and all that - this makes the code more readable, and improves the help text.
Before:
After:
We could possibly improve this a little bit further by using
#[clap(default...)]
(https://docs.rs/clap/latest/clap/_derive/index.html#arg-attributes) and have Clap fancily format the ValueEnum options into showing the defaults, but that gets complicated with the config file. Maybe another time :DThis PR also removes multiple instances of
match
on boolean values, replacing them withif
, and resolves several other Clippy suggestions/fixes.