Skip to content

Commit

Permalink
Update to Clap 4 for parsing command-line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmorcos committed Sep 4, 2024
1 parent eb5989f commit 649425f
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 106 deletions.
192 changes: 91 additions & 101 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tvrank = { path = "../lib", version = "0.8.5" }
indicatif = "0.16"
log = "0.4"
atoi = "2.0"
clap = { version = "3", features = ["derive"] }
clap = { version = "4", features = ["derive"] }
env_logger = "0.10"
derive_more = "0.99"
reqwest = { version = "0.11", features = ["blocking"] }
Expand Down
6 changes: 3 additions & 3 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ struct GeneralOpts {
#[clap(short, long)]
force_update: bool,

/// Display colors regardless of the NO_COLOR environment variable
/// Display colors even when the NO_COLOR environment variable is set
#[clap(short, long)]
color: bool,

/// Verbose output (can be specified multiple times)
#[clap(short, long, parse(from_occurrences))]
#[clap(short, long, action = clap::ArgAction::Count)]
verbose: u8,
}

Expand All @@ -130,7 +130,7 @@ struct SearchOpts {
top: Option<usize>,

/// Set output format
#[clap(short, long, arg_enum, default_value = "table")]
#[clap(short, long, value_enum, default_value = "table")]
output: OutputFormat,
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum Error {
Table(#[from] url::ParseError),
}

#[derive(Debug, Clone, clap::ArgEnum)]
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum OutputFormat {
Json,
Table,
Expand Down

0 comments on commit 649425f

Please sign in to comment.