From 37600ef708c11a5f64b5e3f29f38fcd4e1a6f7dd Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sat, 1 Jan 2022 14:48:43 -0800 Subject: [PATCH] Switched to clap 3.0 --- khonsu-tools/Cargo.toml | 2 +- khonsu-tools/src/lib.rs | 14 +++++++------- khonsu-universal-tools/Cargo.toml | 2 +- khonsu-universal-tools/src/lib.rs | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/khonsu-tools/Cargo.toml b/khonsu-tools/Cargo.toml index 6d03fdd..667be23 100644 --- a/khonsu-tools/Cargo.toml +++ b/khonsu-tools/Cargo.toml @@ -11,7 +11,7 @@ publish = false khonsu-universal-tools = { path = "../khonsu-universal-tools" } devx-cmd = "0.5" devx-pre-commit = "0.5" -structopt = "0.3" +clap = { version = "3", features = ["derive"] } badge = "0.3" anyhow = "1" serde_json = "1" diff --git a/khonsu-tools/src/lib.rs b/khonsu-tools/src/lib.rs index ee48a01..748b460 100644 --- a/khonsu-tools/src/lib.rs +++ b/khonsu-tools/src/lib.rs @@ -1,23 +1,23 @@ pub use khonsu_universal_tools as universal; -use structopt::StructOpt; +use clap::Parser; use universal::DefaultConfig; pub mod publish; -#[derive(StructOpt, Debug)] +#[derive(Parser, Debug)] pub enum Commands { Readmes { - #[structopt(long)] + #[clap(long)] release: bool, }, Publish { - #[structopt(long)] + #[clap(long)] dry_run: bool, - #[structopt(long)] + #[clap(long)] allow_dirty: bool, }, - #[structopt(flatten)] + #[clap(flatten)] Universal(universal::Commands), } @@ -35,7 +35,7 @@ impl Commands { } pub fn main() -> anyhow::Result<()> { - let command = Commands::from_args(); + let command = Commands::parse(); command.execute::() } diff --git a/khonsu-universal-tools/Cargo.toml b/khonsu-universal-tools/Cargo.toml index a312baf..721731d 100644 --- a/khonsu-universal-tools/Cargo.toml +++ b/khonsu-universal-tools/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] devx-cmd = "0.5" devx-pre-commit = "0.5" -structopt = "0.3" +clap = { version = "3", features = ["derive"] } badge = "0.3" anyhow = "1" serde_json = "1" diff --git a/khonsu-universal-tools/src/lib.rs b/khonsu-universal-tools/src/lib.rs index e68da00..50fb0e2 100644 --- a/khonsu-universal-tools/src/lib.rs +++ b/khonsu-universal-tools/src/lib.rs @@ -1,20 +1,20 @@ pub use anyhow; pub use badge; +pub use clap; pub use devx_cmd; -pub use structopt; pub mod audit; pub mod code_coverage; pub mod pre_commit; use self::{audit::Audit, code_coverage::CodeCoverage}; -use structopt::StructOpt; +use clap::Parser; -#[derive(StructOpt, Debug)] +#[derive(Parser, Debug)] pub enum Commands { /// Generates a code coverage report. GenerateCodeCoverageReport { - #[structopt(long = "install-dependencies")] + #[clap(long = "install-dependencies")] install_dependencies: bool, }, /// Executes `cargo-deny` @@ -36,7 +36,7 @@ impl Commands { } pub fn main() -> anyhow::Result<()> { - let command = Commands::from_args(); + let command = Commands::parse(); command.execute::() }