Bump clap version to 4.0 (#81)

This commit is contained in:
Marcin Puc
2022-10-27 17:51:43 +02:00
committed by GitHub
parent 3a5cc8a388
commit 6a3de81f1f
3 changed files with 28 additions and 36 deletions

20
Cargo.lock generated
View File

@@ -224,26 +224,24 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.22" version = "4.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"indexmap",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.18" version = "4.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" checksum = "16a1b0f6422af32d5da0c58e2703320f379216ee70198241c84173a8c5ac28f3"
dependencies = [ dependencies = [
"heck 0.4.0", "heck 0.4.0",
"proc-macro-error", "proc-macro-error",
@@ -254,9 +252,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.2.4" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
@@ -1785,12 +1783,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "textwrap"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.37" version = "1.0.37"

View File

@@ -23,7 +23,7 @@ serde = { version = "1.0", features = ["derive"] }
toml = "0.5" toml = "0.5"
which_crate = { version = "4.1", package = "which" } which_crate = { version = "4.1", package = "which" }
shellexpand = "2.1" shellexpand = "2.1"
clap = { version = "3.1", features = ["cargo", "derive"] } clap = { version = "4.0", features = ["cargo", "derive"] }
log = "0.4" log = "0.4"
walkdir = "2.3" walkdir = "2.3"
console = "0.15" console = "0.15"

View File

@@ -6,7 +6,7 @@ use std::process::Command;
use std::{env, fs}; use std::{env, fs};
use anyhow::Result; use anyhow::Result;
use clap::{ArgEnum, Parser}; use clap::{Parser, ValueEnum};
use directories::BaseDirs; use directories::BaseDirs;
use log::debug; use log::debug;
use regex::Regex; use regex::Regex;
@@ -62,7 +62,7 @@ macro_rules! get_deprecated {
type Commands = BTreeMap<String, String>; type Commands = BTreeMap<String, String>;
#[derive(ArgEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)] #[derive(ValueEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)]
#[clap(rename_all = "snake_case")] #[clap(rename_all = "snake_case")]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")] #[strum(serialize_all = "snake_case")]
@@ -386,78 +386,78 @@ 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", arg_enum, multiple_values = true)] #[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", arg_enum, multiple_values = true)] #[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")] #[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", multiple_values = true)] #[arg(long = "env", value_name = "NAME=VALUE", num_args = 1..)]
env: Vec<String>, env: Vec<String>,
/// Output logs /// Output logs
#[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(short = 'y', long = "yes", arg_enum, multiple_values = true, min_values = 0)] #[arg(short = 'y', long = "yes", value_name = "STEP", value_enum, num_args = 0..)]
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")] #[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")] #[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,
} }