Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Update to clap 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lwagner94 committed Feb 4, 2023
1 parent 194b5b8 commit 4686812
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
22 changes: 7 additions & 15 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parity-wasm = { git = "https://github.com/lwagner94/parity-wasm", branch="instru

anyhow = "1.0"
regex = "1.7"
clap = {version = "3.0", features=["cargo", "derive"]} # TODO
clap = {version = "4.1", features=["cargo", "derive"]} # TODO
object = { version = "0.30", features = ["read", "wasm"]}
addr2line = "0.19"
gimli = "0.27"
Expand Down
17 changes: 14 additions & 3 deletions src/cliarguments.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ffi::OsString;

use clap::{ArgEnum, Parser, Subcommand};
use clap::{Parser, Subcommand, ValueEnum};

#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
Expand Down Expand Up @@ -63,7 +63,7 @@ pub enum CLICommand {
threads: Option<usize>,

/// Report output format
#[clap(short, long, arg_enum, default_value_t=Output::Console)]
#[clap(short, long, value_enum, default_value_t=Output::Console)]
report: Output,

/// Output directory for reports
Expand Down Expand Up @@ -117,7 +117,7 @@ pub enum CLICommand {
},
}

#[derive(ArgEnum, Clone, Debug)]
#[derive(ValueEnum, Clone, Debug)]
pub enum Output {
Console,
Html,
Expand All @@ -138,3 +138,14 @@ impl CLIArguments {
Self::parse_from(itr)
}
}

#[cfg(test)]
mod tests {
use crate::cliarguments::CLIArguments;

#[test]
fn test_cli() {
use clap::CommandFactory;
CLIArguments::command().debug_assert()
}
}

0 comments on commit 4686812

Please sign in to comment.