mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 02:20:58 -05:00
fix(cli): Improve help layout
This commit is contained in:
parent
569b09780b
commit
21c88ca878
2 changed files with 82 additions and 68 deletions
|
@ -42,60 +42,67 @@ pub(crate) struct Args {
|
||||||
#[arg(default_value = ".")]
|
#[arg(default_value = ".")]
|
||||||
pub(crate) path: Vec<std::path::PathBuf>,
|
pub(crate) path: Vec<std::path::PathBuf>,
|
||||||
|
|
||||||
/// Custom config file
|
|
||||||
#[arg(short = 'c', long = "config")]
|
|
||||||
pub(crate) custom_config: Option<std::path::PathBuf>,
|
|
||||||
|
|
||||||
/// Ignore implicit configuration files.
|
|
||||||
#[arg(long)]
|
|
||||||
pub(crate) isolated: bool,
|
|
||||||
|
|
||||||
/// Print a diff of what would change
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) diff: bool,
|
|
||||||
|
|
||||||
/// Write fixes out
|
|
||||||
#[arg(long, short = 'w', group = "mode")]
|
|
||||||
pub(crate) write_changes: bool,
|
|
||||||
|
|
||||||
/// Debug: Print each file that would be spellchecked.
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) files: bool,
|
|
||||||
|
|
||||||
/// Debug: Print each file's type
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) file_types: bool,
|
|
||||||
|
|
||||||
/// Debug: Print each identifier that would be spellchecked.
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) identifiers: bool,
|
|
||||||
|
|
||||||
/// Debug: Print each word that would be spellchecked.
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) words: bool,
|
|
||||||
|
|
||||||
/// Write the current configuration to file with `-` for stdout
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) dump_config: Option<std::path::PathBuf>,
|
|
||||||
|
|
||||||
/// Show all supported file types.
|
|
||||||
#[arg(long, group = "mode")]
|
|
||||||
pub(crate) type_list: bool,
|
|
||||||
|
|
||||||
#[arg(long, value_enum, ignore_case = true, default_value("long"))]
|
|
||||||
pub(crate) format: Format,
|
|
||||||
|
|
||||||
/// The approximate number of threads to use.
|
/// The approximate number of threads to use.
|
||||||
#[arg(short = 'j', long = "threads", default_value = "0")]
|
#[arg(short = 'j', long = "threads", default_value = "0")]
|
||||||
pub(crate) threads: usize,
|
pub(crate) threads: usize,
|
||||||
|
|
||||||
#[command(flatten)]
|
/// Custom config file
|
||||||
|
#[arg(short = 'c', long = "config", help_heading = "Config")]
|
||||||
|
pub(crate) custom_config: Option<std::path::PathBuf>,
|
||||||
|
|
||||||
|
/// Ignore implicit configuration files.
|
||||||
|
#[arg(long, help_heading = "Config")]
|
||||||
|
pub(crate) isolated: bool,
|
||||||
|
|
||||||
|
#[command(flatten, next_help_heading = "Config")]
|
||||||
pub(crate) config: ConfigArgs,
|
pub(crate) config: ConfigArgs,
|
||||||
|
|
||||||
#[command(flatten)]
|
/// Print a diff of what would change
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) diff: bool,
|
||||||
|
|
||||||
|
/// Write fixes out
|
||||||
|
#[arg(long, short = 'w', group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) write_changes: bool,
|
||||||
|
|
||||||
|
/// Debug: Print each file that would be spellchecked.
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) files: bool,
|
||||||
|
|
||||||
|
/// Debug: Print each file's type
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) file_types: bool,
|
||||||
|
|
||||||
|
/// Debug: Print each identifier that would be spellchecked.
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) identifiers: bool,
|
||||||
|
|
||||||
|
/// Debug: Print each word that would be spellchecked.
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) words: bool,
|
||||||
|
|
||||||
|
/// Write the current configuration to file with `-` for stdout
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) dump_config: Option<std::path::PathBuf>,
|
||||||
|
|
||||||
|
/// Show all supported file types.
|
||||||
|
#[arg(long, group = "mode", help_heading = "Mode")]
|
||||||
|
pub(crate) type_list: bool,
|
||||||
|
|
||||||
|
/// Render style for messages
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
value_enum,
|
||||||
|
ignore_case = true,
|
||||||
|
default_value("long"),
|
||||||
|
help_heading = "Output"
|
||||||
|
)]
|
||||||
|
pub(crate) format: Format,
|
||||||
|
|
||||||
|
#[command(flatten, next_help_heading = "Output")]
|
||||||
pub(crate) color: colorchoice_clap::Color,
|
pub(crate) color: colorchoice_clap::Color,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten, next_help_heading = "Output")]
|
||||||
pub(crate) verbose: clap_verbosity_flag::Verbosity,
|
pub(crate) verbose: clap_verbosity_flag::Verbosity,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +133,7 @@ pub(crate) struct FileArgs {
|
||||||
#[arg(long, overrides_with("unicode"))]
|
#[arg(long, overrides_with("unicode"))]
|
||||||
no_unicode: bool,
|
no_unicode: bool,
|
||||||
|
|
||||||
|
/// Language locale to suggest corrections for
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
#[arg(
|
#[arg(
|
||||||
value_parser = clap::builder::PossibleValuesParser::new(config::Locale::variants())
|
value_parser = clap::builder::PossibleValuesParser::new(config::Locale::variants())
|
||||||
|
|
|
@ -3,24 +3,19 @@ args = "--help"
|
||||||
stdout = """
|
stdout = """
|
||||||
Source Code Spelling Correction
|
Source Code Spelling Correction
|
||||||
|
|
||||||
Usage: typos [OPTIONS] [PATH]...
|
Usage: typos[EXE] [OPTIONS] [PATH]...
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
[PATH]... Paths to check with `-` for stdin [default: .]
|
[PATH]... Paths to check with `-` for stdin [default: .]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-j, --threads <THREADS> The approximate number of threads to use [default: 0]
|
||||||
|
-h, --help Print help
|
||||||
|
-V, --version Print version
|
||||||
|
|
||||||
|
Config:
|
||||||
-c, --config <CUSTOM_CONFIG> Custom config file
|
-c, --config <CUSTOM_CONFIG> Custom config file
|
||||||
--isolated Ignore implicit configuration files
|
--isolated Ignore implicit configuration files
|
||||||
--diff Print a diff of what would change
|
|
||||||
-w, --write-changes Write fixes out
|
|
||||||
--files Debug: Print each file that would be spellchecked
|
|
||||||
--file-types Debug: Print each file's type
|
|
||||||
--identifiers Debug: Print each identifier that would be spellchecked
|
|
||||||
--words Debug: Print each word that would be spellchecked
|
|
||||||
--dump-config <DUMP_CONFIG> Write the current configuration to file with `-` for stdout
|
|
||||||
--type-list Show all supported file types
|
|
||||||
--format <FORMAT> [default: long] [possible values: silent, brief, long, json]
|
|
||||||
-j, --threads <THREADS> The approximate number of threads to use [default: 0]
|
|
||||||
--exclude <GLOB> Ignore files & directories matching the glob
|
--exclude <GLOB> Ignore files & directories matching the glob
|
||||||
--hidden Search hidden files and directories
|
--hidden Search hidden files and directories
|
||||||
--no-ignore Don't respect ignore files
|
--no-ignore Don't respect ignore files
|
||||||
|
@ -32,11 +27,22 @@ Options:
|
||||||
--no-check-filenames Skip verifying spelling in file names
|
--no-check-filenames Skip verifying spelling in file names
|
||||||
--no-check-files Skip verifying spelling in files
|
--no-check-files Skip verifying spelling in files
|
||||||
--no-unicode Only allow ASCII characters in identifiers
|
--no-unicode Only allow ASCII characters in identifiers
|
||||||
--locale <LOCALE> [possible values: en, en-us, en-gb, en-ca, en-au]
|
--locale <LOCALE> Language locale to suggest corrections for [possible values: en, en-us, en-gb, en-ca, en-au]
|
||||||
|
|
||||||
|
Mode:
|
||||||
|
--diff Print a diff of what would change
|
||||||
|
-w, --write-changes Write fixes out
|
||||||
|
--files Debug: Print each file that would be spellchecked
|
||||||
|
--file-types Debug: Print each file's type
|
||||||
|
--identifiers Debug: Print each identifier that would be spellchecked
|
||||||
|
--words Debug: Print each word that would be spellchecked
|
||||||
|
--dump-config <DUMP_CONFIG> Write the current configuration to file with `-` for stdout
|
||||||
|
--type-list Show all supported file types
|
||||||
|
|
||||||
|
Output:
|
||||||
|
--format <FORMAT> Render style for messages [default: long] [possible values: silent, brief, long, json]
|
||||||
--color <WHEN> Controls when to use color [default: auto] [possible values: auto, always, never]
|
--color <WHEN> Controls when to use color [default: auto] [possible values: auto, always, never]
|
||||||
-v, --verbose... More output per occurrence
|
-v, --verbose... More output per occurrence
|
||||||
-q, --quiet... Less output per occurrence
|
-q, --quiet... Less output per occurrence
|
||||||
-h, --help Print help
|
|
||||||
-V, --version Print version
|
|
||||||
"""
|
"""
|
||||||
stderr = ""
|
stderr = ""
|
||||||
|
|
Loading…
Reference in a new issue