Update to clap 4.0

This commit is contained in:
Joscha 2022-09-29 12:47:02 +02:00
parent ec34a45f2b
commit 3895388e54
4 changed files with 19 additions and 37 deletions

30
Cargo.lock generated
View file

@ -109,26 +109,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.22" version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" checksum = "31c9484ccdc4cb8e7b117cbd0eb150c7c0f04464854e4679aeb50ef03b32d003"
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.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" checksum = "ca689d7434ce44517a12a89456b2be4d1ea1cafcd8f581978c03d45f5a5c12a7"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -139,9 +137,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",
] ]
@ -487,16 +485,6 @@ dependencies = [
"unicode-normalization", "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]] [[package]]
name = "instant" name = "instant"
version = "0.1.12" version = "0.1.12"
@ -1075,12 +1063,6 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[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.36" version = "1.0.36"

View file

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
anyhow = "1.0.65" anyhow = "1.0.65"
async-trait = "0.1.57" async-trait = "0.1.57"
clap = { version = "3.2.22", features = ["derive"] } clap = { version = "4.0.2", features = ["derive", "deprecated"] }
cookie = "0.16.1" cookie = "0.16.1"
crossterm = "0.25.0" crossterm = "0.25.0"
directories = "4.0.1" directories = "4.0.1"

View file

@ -37,11 +37,11 @@ pub struct Args {
rooms: Vec<String>, rooms: Vec<String>,
/// Export all rooms. /// Export all rooms.
#[clap(long, short)] #[arg(long, short)]
all: bool, all: bool,
/// Format of the output file. /// 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, format: Format,
/// Location of the output file /// Location of the output file
@ -55,8 +55,8 @@ pub struct Args {
/// `%r.%e` will be appended. /// `%r.%e` will be appended.
/// ///
/// Must be a valid utf-8 encoded string. /// Must be a valid utf-8 encoded string.
#[clap(long, short, default_value_t = Into::into("%r.%e"))] #[arg(long, short, default_value_t = Into::into("%r.%e"))]
#[clap(verbatim_doc_comment)] #[arg(verbatim_doc_comment)]
out: String, out: String,
} }

View file

@ -41,7 +41,7 @@ use vault::Vault;
use crate::config::Config; use crate::config::Config;
use crate::logger::Logger; use crate::logger::Logger;
#[derive(Debug, clap::Subcommand)] #[derive(Debug, clap::Parser)]
enum Command { enum Command {
/// Run the client interactively (default). /// Run the client interactively (default).
Run, Run,
@ -60,34 +60,34 @@ impl Default for Command {
} }
#[derive(Debug, clap::Parser)] #[derive(Debug, clap::Parser)]
#[clap(version)] #[command(version)]
struct Args { struct Args {
/// Path to the config file. /// Path to the config file.
/// ///
/// Relative paths are interpreted relative to the current directory. /// Relative paths are interpreted relative to the current directory.
#[clap(long, short)] #[arg(long, short)]
config: Option<PathBuf>, config: Option<PathBuf>,
/// Path to a directory for cove to store its data in. /// Path to a directory for cove to store its data in.
/// ///
/// Relative paths are interpreted relative to the current directory. /// Relative paths are interpreted relative to the current directory.
#[clap(long, short)] #[arg(long, short)]
data_dir: Option<PathBuf>, data_dir: Option<PathBuf>,
/// If set, cove won't store data permanently. /// If set, cove won't store data permanently.
#[clap(long, short, action)] #[arg(long, short)]
ephemeral: bool, ephemeral: bool,
/// If set, cove will ignore the autojoin config option. /// If set, cove will ignore the autojoin config option.
#[clap(long, short, action)] #[arg(long, short)]
offline: bool, offline: bool,
/// Measure the width of characters as displayed by the terminal emulator /// Measure the width of characters as displayed by the terminal emulator
/// instead of guessing the width. /// instead of guessing the width.
#[clap(long, short, action)] #[arg(long, short)]
measure_widths: bool, measure_widths: bool,
#[clap(subcommand)] #[command(subcommand)]
command: Option<Command>, command: Option<Command>,
} }