From 55e7bd265d64e6f331daa36e374f5ff161197b12 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 28 Sep 2022 15:22:41 -0500 Subject: [PATCH 1/2] chore: Upgrade to 2021 edition --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 76503a1..f3a40a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ documentation = "https://github.com/gitext-rs/git-branch-stash.git" readme = "README.md" categories = ["command-line-interface", "development-tools"] keywords = ["git", "cli"] -edition = "2018" +edition = "2021" rust-version = "1.60.0" # MSRV include = [ "src/**/*", From 7c10288aef4982e5d1bc5a0a81e2c74f72bdd94c Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 28 Sep 2022 15:25:16 -0500 Subject: [PATCH 2/2] refactor: Upgrade to v4 --- Cargo.lock | 48 ++++++++++++------------------------------------ Cargo.toml | 6 +++--- src/args.rs | 26 ++++++++++++-------------- 3 files changed, 27 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5891496..74cd47c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,26 +110,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.19" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d43934757334b5c0519ff882e1ab9647ac0258b47c24c4f490d78e42697fd5" +checksum = "dd03107d0f87139c1774a15f3db2165b0652b5460c58c27e561f89c20c599eaf" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap-verbosity-flag" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0636f9c040082f8e161555a305f8cec1a1c2828b3d981c812b8c39f4ac00c42c" +checksum = "23e2b6c3dcdb73299f48ae05b294da14e2f560b3ed2c09e742269eb1b22af231" dependencies = [ "clap", "log", @@ -137,9 +135,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "ca689d7434ce44517a12a89456b2be4d1ea1cafcd8f581978c03d45f5a5c12a7" dependencies = [ "heck", "proc-macro-error", @@ -150,9 +148,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] @@ -170,9 +168,9 @@ dependencies = [ [[package]] name = "concolor-clap" -version = "0.0.10" +version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35b55e880d42d4626e6a1aa5b4e63a4df61cf024472a31495ecbbb712402985" +checksum = "95a363283eeb30dc209fca344607b1b40135bfcca5172aa90fb72d912b992bbf" dependencies = [ "clap", "concolor", @@ -314,12 +312,6 @@ dependencies = [ "which", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - [[package]] name = "heck" version = "0.4.0" @@ -367,16 +359,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" -[[package]] -name = "indexmap" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "itertools" version = "0.10.3" @@ -571,9 +553,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" dependencies = [ "unicode-ident", ] @@ -697,12 +679,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" - [[package]] name = "tinyvec" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index f3a40a2..5a30980 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,8 +39,8 @@ path = "src/main.rs" doc = false [dependencies] -clap = { version = "3.2", features = ["derive"] } -clap-verbosity-flag = "1.0" +clap = { version = "4.0.0", features = ["derive"] } +clap-verbosity-flag = "2.0" env_logger = { version = "0.9", default-features = false, features = ["termcolor"] } log = "0.4" proc-exit = "1" @@ -48,7 +48,7 @@ eyre = "0.6" human-panic = "1" yansi = "0.5.1" concolor = "0.0.8" -concolor-clap = { version = "0.0.10", features = ["api_unstable"] } +concolor-clap = { version = "0.0.11", features = ["api_unstable"] } git-branch-stash = { version = "0.8.0", path = "crates/git-branch-stash" } git2 = { version = "0.14", default-features = false, features = ["vendored-libgit2"] } diff --git a/src/args.rs b/src/args.rs index df61019..a1883ae 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,22 +1,20 @@ #[derive(Debug, clap::Parser)] -#[clap(name = "git-branch-stash", about, author, version)] -#[clap( - setting = clap::AppSettings::DeriveDisplayOrder, - dont_collapse_args_in_usage = true, +#[command(name = "git-branch-stash", about, author, version)] +#[command( args_conflicts_with_subcommands = true, color = concolor_clap::color_choice(), )] pub struct Args { - #[clap(subcommand)] + #[command(subcommand)] pub subcommand: Option, - #[clap(flatten)] + #[command(flatten)] pub push: PushArgs, - #[clap(flatten)] + #[command(flatten)] pub(crate) color: concolor_clap::Color, - #[clap(flatten)] + #[command(flatten)] pub verbose: clap_verbosity_flag::Verbosity, } @@ -41,39 +39,39 @@ pub enum Subcommand { #[derive(Debug, clap::Args)] pub struct PushArgs { /// Specify which stash stack to use - #[clap(default_value = git_branch_stash::Stack::DEFAULT_STACK)] + #[arg(default_value = git_branch_stash::Stack::DEFAULT_STACK)] pub stack: String, /// Annotate the snapshot with the given message - #[clap(short, long)] + #[arg(short, long)] pub message: Option, } #[derive(Debug, clap::Args)] pub struct ListArgs { /// Specify which stash stack to use - #[clap(default_value = git_branch_stash::Stack::DEFAULT_STACK)] + #[arg(default_value = git_branch_stash::Stack::DEFAULT_STACK)] pub stack: String, } #[derive(Debug, clap::Args)] pub struct ClearArgs { /// Specify which stash stack to use - #[clap(default_value = git_branch_stash::Stack::DEFAULT_STACK)] + #[arg(default_value = git_branch_stash::Stack::DEFAULT_STACK)] pub stack: String, } #[derive(Debug, clap::Args)] pub struct DropArgs { /// Specify which stash stack to use - #[clap(default_value = git_branch_stash::Stack::DEFAULT_STACK)] + #[arg(default_value = git_branch_stash::Stack::DEFAULT_STACK)] pub stack: String, } #[derive(Debug, clap::Args)] pub struct ApplyArgs { /// Specify which stash stack to use - #[clap(default_value = git_branch_stash::Stack::DEFAULT_STACK)] + #[arg(default_value = git_branch_stash::Stack::DEFAULT_STACK)] pub stack: String, }