Small clap adjustments (#846)

* style(cli): use new clap keywords

* fix(cli): use lowercase command name
This commit is contained in:
tranzystorekk
2024-07-01 11:06:04 +02:00
committed by GitHub
parent 13330b6950
commit a9f57d4205

View File

@@ -676,62 +676,62 @@ impl ConfigFile {
// Command line arguments // Command line arguments
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap(name = "Topgrade", version)] #[command(name = "topgrade", version)]
pub struct CommandLineArgs { pub struct CommandLineArgs {
/// Edit the configuration file /// Edit the configuration file
#[clap(long = "edit-config")] #[arg(long = "edit-config")]
edit_config: bool, edit_config: bool,
/// Show config reference /// Show config reference
#[clap(long = "config-reference")] #[arg(long = "config-reference")]
show_config_reference: bool, show_config_reference: bool,
/// Run inside tmux /// Run inside tmux
#[clap(short = 't', long = "tmux")] #[arg(short = 't', long = "tmux")]
run_in_tmux: bool, run_in_tmux: bool,
/// Cleanup temporary or old files /// Cleanup temporary or old files
#[clap(short = 'c', long = "cleanup")] #[arg(short = 'c', long = "cleanup")]
cleanup: bool, cleanup: bool,
/// Print what would be done /// Print what would be done
#[clap(short = 'n', long = "dry-run")] #[arg(short = 'n', long = "dry-run")]
dry_run: bool, dry_run: bool,
/// Do not ask to retry failed steps /// Do not ask to retry failed steps
#[clap(long = "no-retry")] #[arg(long = "no-retry")]
no_retry: bool, no_retry: bool,
/// Do not perform upgrades for the given steps /// Do not perform upgrades for the given steps
#[clap(long = "disable", value_name = "STEP", value_enum, num_args = 1..)] #[arg(long = "disable", value_name = "STEP", value_enum, num_args = 1..)]
disable: Vec<Step>, disable: Vec<Step>,
/// Perform only the specified steps (experimental) /// Perform only the specified steps (experimental)
#[clap(long = "only", value_name = "STEP", value_enum, num_args = 1..)] #[arg(long = "only", value_name = "STEP", value_enum, num_args = 1..)]
only: Vec<Step>, only: Vec<Step>,
/// Run only specific custom commands /// Run only specific custom commands
#[clap(long = "custom-commands", value_name = "NAME", num_args = 1..)] #[arg(long = "custom-commands", value_name = "NAME", num_args = 1..)]
custom_commands: Vec<String>, custom_commands: Vec<String>,
/// Set environment variables /// Set environment variables
#[clap(long = "env", value_name = "NAME=VALUE", num_args = 1..)] #[arg(long = "env", value_name = "NAME=VALUE", num_args = 1..)]
env: Vec<String>, env: Vec<String>,
/// Output debug logs. Alias for `--log-filter debug`. /// Output debug logs. Alias for `--log-filter debug`.
#[clap(short = 'v', long = "verbose")] #[arg(short = 'v', long = "verbose")]
pub verbose: bool, pub verbose: bool,
/// Prompt for a key before exiting /// Prompt for a key before exiting
#[clap(short = 'k', long = "keep")] #[arg(short = 'k', long = "keep")]
keep_at_end: bool, keep_at_end: bool,
/// Skip sending a notification at the end of a run /// Skip sending a notification at the end of a run
#[clap(long = "skip-notify")] #[arg(long = "skip-notify")]
skip_notify: bool, skip_notify: bool,
/// Say yes to package manager's prompt /// Say yes to package manager's prompt
#[clap( #[arg(
short = 'y', short = 'y',
long = "yes", long = "yes",
value_name = "STEP", value_name = "STEP",
@@ -741,37 +741,37 @@ pub struct CommandLineArgs {
yes: Option<Vec<Step>>, yes: Option<Vec<Step>>,
/// Don't pull the predefined git repos /// Don't pull the predefined git repos
#[clap(long = "disable-predefined-git-repos")] #[arg(long = "disable-predefined-git-repos")]
disable_predefined_git_repos: bool, disable_predefined_git_repos: bool,
/// Alternative configuration file /// Alternative configuration file
#[clap(long = "config", value_name = "PATH")] #[arg(long = "config", value_name = "PATH")]
config: Option<PathBuf>, config: Option<PathBuf>,
/// A regular expression for restricting remote host execution /// A regular expression for restricting remote host execution
#[clap(long = "remote-host-limit", value_name = "REGEX")] #[arg(long = "remote-host-limit", value_name = "REGEX")]
remote_host_limit: Option<Regex>, remote_host_limit: Option<Regex>,
/// Show the reason for skipped steps /// Show the reason for skipped steps
#[clap(long = "show-skipped")] #[arg(long = "show-skipped")]
show_skipped: bool, show_skipped: bool,
/// Tracing filter directives. /// Tracing filter directives.
/// ///
/// See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html /// See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html
#[clap(long, default_value = DEFAULT_LOG_LEVEL)] #[arg(long, default_value = DEFAULT_LOG_LEVEL)]
pub log_filter: String, pub log_filter: String,
/// Print completion script for the given shell and exit /// Print completion script for the given shell and exit
#[clap(long, value_enum, hide = true)] #[arg(long, value_enum, hide = true)]
pub gen_completion: Option<Shell>, pub gen_completion: Option<Shell>,
/// Print roff manpage and exit /// Print roff manpage and exit
#[clap(long, hide = true)] #[arg(long, hide = true)]
pub gen_manpage: bool, pub gen_manpage: bool,
/// Don't update Topgrade /// Don't update Topgrade
#[clap(long = "no-self-update")] #[arg(long = "no-self-update")]
pub no_self_update: bool, pub no_self_update: bool,
} }