From 3895388e548d6793a220942cfc20a171d2ffc350 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 29 Sep 2022 12:47:02 +0200 Subject: Update to clap 4.0 --- Cargo.lock | 30 ++++++------------------------ Cargo.toml | 2 +- src/export.rs | 8 ++++---- src/main.rs | 16 ++++++++-------- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14a9ad0..f1cfb5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,26 +109,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.22" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "31c9484ccdc4cb8e7b117cbd0eb150c7c0f04464854e4679aeb50ef03b32d003" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", "once_cell", "strsim", "termcolor", - "textwrap", ] [[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", @@ -139,9 +137,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", ] @@ -487,16 +485,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "instant" version = "0.1.12" @@ -1075,12 +1063,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" - [[package]] name = "thiserror" version = "1.0.36" diff --git a/Cargo.toml b/Cargo.toml index 6b26974..d818ce3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] anyhow = "1.0.65" async-trait = "0.1.57" -clap = { version = "3.2.22", features = ["derive"] } +clap = { version = "4.0.2", features = ["derive", "deprecated"] } cookie = "0.16.1" crossterm = "0.25.0" directories = "4.0.1" diff --git a/src/export.rs b/src/export.rs index 75ad782..c76009c 100644 --- a/src/export.rs +++ b/src/export.rs @@ -37,11 +37,11 @@ pub struct Args { rooms: Vec, /// Export all rooms. - #[clap(long, short)] + #[arg(long, short)] all: bool, /// Format of the output file. - #[clap(long, short, value_enum, default_value_t = Format::Text)] + #[arg(long, short, value_enum, default_value_t = Format::Text)] format: Format, /// Location of the output file @@ -55,8 +55,8 @@ pub struct Args { /// `%r.%e` will be appended. /// /// Must be a valid utf-8 encoded string. - #[clap(long, short, default_value_t = Into::into("%r.%e"))] - #[clap(verbatim_doc_comment)] + #[arg(long, short, default_value_t = Into::into("%r.%e"))] + #[arg(verbatim_doc_comment)] out: String, } diff --git a/src/main.rs b/src/main.rs index fccc68d..2412ef4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,7 +41,7 @@ use vault::Vault; use crate::config::Config; use crate::logger::Logger; -#[derive(Debug, clap::Subcommand)] +#[derive(Debug, clap::Parser)] enum Command { /// Run the client interactively (default). Run, @@ -60,34 +60,34 @@ impl Default for Command { } #[derive(Debug, clap::Parser)] -#[clap(version)] +#[command(version)] struct Args { /// Path to the config file. /// /// Relative paths are interpreted relative to the current directory. - #[clap(long, short)] + #[arg(long, short)] config: Option, /// Path to a directory for cove to store its data in. /// /// Relative paths are interpreted relative to the current directory. - #[clap(long, short)] + #[arg(long, short)] data_dir: Option, /// If set, cove won't store data permanently. - #[clap(long, short, action)] + #[arg(long, short)] ephemeral: bool, /// If set, cove will ignore the autojoin config option. - #[clap(long, short, action)] + #[arg(long, short)] offline: bool, /// Measure the width of characters as displayed by the terminal emulator /// instead of guessing the width. - #[clap(long, short, action)] + #[arg(long, short)] measure_widths: bool, - #[clap(subcommand)] + #[command(subcommand)] command: Option, } -- cgit v1.2.3