Skip to content

Commit

Permalink
Update clap to v4.
Browse files Browse the repository at this point in the history
  • Loading branch information
gz committed Apr 17, 2023
1 parent 47b3149 commit 927152c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -30,8 +30,8 @@ bitflags = { version = "2.0" }
serde = { version = "1.0", default-features = false, optional = true }
serde_derive = { version = "1.0", optional = true }
serde_json = { version = "1.0", optional = true }
termimad = { version = "0.21", optional = true }
clap = { version = "3.1.6", features = ["derive"], optional = true }
termimad = { version = "0.23", optional = true }
clap = { version = "4.2", features = ["derive"], optional = true }

[target.'cfg(unix)'.dev-dependencies]
core_affinity = "0.8.0"
Expand Down
7 changes: 5 additions & 2 deletions src/bin/cpuid.rs
Expand Up @@ -3,11 +3,14 @@
//! The cpuid binary only compiles/runs on x86 platforms.
use std::str::FromStr;

use clap::Parser;
use clap::{Parser, ValueEnum};
use raw_cpuid::{CpuId, CpuIdReaderNative};

#[derive(ValueEnum, Clone)]
enum OutputFormat {
#[value(alias("raw"))]
Raw,
#[value(alias("cli"))]
Cli,
}

Expand All @@ -29,7 +32,7 @@ impl FromStr for OutputFormat {
#[clap(disable_colored_help(true))]
struct Opts {
/// Configures the output format.
#[clap(short, long, default_value = "cli", possible_values = &["raw", "json", "cli", ])]
#[clap(short, long, default_value = "cli")]
format: OutputFormat,
}

Expand Down

0 comments on commit 927152c

Please sign in to comment.