From 481fe1abed219fe7c7f031c31bea22ac89a5b57a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 28 Sep 2022 12:33:15 -0500 Subject: [PATCH 1/2] fix!: Bump clap to v4 --- Cargo.toml | 2 +- src/lib.rs | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bf7cd17..a076587 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ codecov = { repository = "rust-cli/clap-verbosity-flag" } [dependencies] log = "0.4.1" -clap = { version = "3.0", default-features = false, features = ["std", "derive"] } +clap = { version = "4.0.0", default-features = false, features = ["std", "derive"] } [dev-dependencies] env_logger = "0.9.0" diff --git a/src/lib.rs b/src/lib.rs index 624fea4..a805753 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ //! # /// Le CLI //! # #[derive(Debug, Parser)] //! # struct Cli { -//! #[clap(flatten)] +//! #[command(flatten)] //! verbose: Verbosity, //! # } //! ``` @@ -24,7 +24,7 @@ //! # /// Le CLI //! # #[derive(Debug, Parser)] //! # struct Cli { -//! # #[clap(flatten)] +//! # #[command(flatten)] //! # verbose: Verbosity, //! # } //! let cli = Cli::parse(); @@ -48,7 +48,7 @@ //! /// Le CLI //! #[derive(Debug, Parser)] //! struct Cli { -//! #[clap(flatten)] +//! #[command(flatten)] //! verbose: Verbosity, //! } //! ``` @@ -57,34 +57,34 @@ #[derive(clap::Args, Debug, Clone)] pub struct Verbosity { - #[clap( + #[arg( long, short = 'v', - parse(from_occurrences), + action = clap::ArgAction::Count, global = true, help = L::verbose_help(), long_help = L::verbose_long_help(), )] - verbose: i8, + verbose: u8, - #[clap( + #[arg( long, short = 'q', - parse(from_occurrences), + action = clap::ArgAction::Count, global = true, help = L::quiet_help(), long_help = L::quiet_long_help(), conflicts_with = "verbose", )] - quiet: i8, + quiet: u8, - #[clap(skip)] + #[arg(skip)] phantom: std::marker::PhantomData, } impl Verbosity { /// Create a new verbosity instance by explicitly setting the values - pub fn new(verbose: i8, quiet: i8) -> Self { + pub fn new(verbose: u8, quiet: u8) -> Self { Verbosity { verbose, quiet, @@ -112,7 +112,7 @@ impl Verbosity { } fn verbosity(&self) -> i8 { - level_value(L::default()) - self.quiet + self.verbose + level_value(L::default()) - (self.quiet as i8) + (self.verbose as i8) } } From 56cfe01a0b149abde928576f13e31a9122d3fdd3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 28 Sep 2022 12:33:48 -0500 Subject: [PATCH 2/2] chore: Bump MSRV to 1.60.0 --- .clippy.toml | 2 +- .github/workflows/ci.yml | 6 +++--- .github/workflows/rust-next.yml | 4 ++-- Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 00d5361..23bf481 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.56.1" # MSRV +msrv = "1.60.0" # MSRV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5599687..61178bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: No-default features run: cargo test --workspace --no-default-features msrv: - name: "Check MSRV: 1.56.1" + name: "Check MSRV: 1.60.0" runs-on: ubuntu-latest steps: - name: Checkout repository @@ -59,7 +59,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 # MSRV + toolchain: 1.60.0 # MSRV profile: minimal override: true - uses: Swatinem/rust-cache@v1 @@ -113,7 +113,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 # MSRV + toolchain: 1.60.0 # MSRV profile: minimal override: true components: clippy diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml index 76dec95..7fdfd12 100644 --- a/.github/workflows/rust-next.yml +++ b/.github/workflows/rust-next.yml @@ -57,9 +57,9 @@ jobs: strategy: matrix: rust: - - 1.56.1 # MSRV + - 1.60.0 # MSRV - stable - continue-on-error: ${{ matrix.rust != '1.56.1' }} # MSRV + continue-on-error: ${{ matrix.rust != '1.60.0' }} # MSRV runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/Cargo.toml b/Cargo.toml index a076587..c33e877 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rust-clique/clap-verbosity-flag" readme = "README.md" edition = "2021" -rust-version = "1.56.1" # MSRV +rust-version = "1.60.0" # MSRV include = [ "src/**/*", "Cargo.toml",