Skip to content

Commit

Permalink
Fix clap for CI (bevyengine#5005)
Browse files Browse the repository at this point in the history
# Objective

- Fix CI
- relevant clap issue clap-rs/clap#3822

## Solution

- slap `value_parser` on all the clap derives. This tells clap to use the default parser for the type.
  • Loading branch information
hymm authored and ItsDoot committed Feb 1, 2023
1 parent eedd4ad commit 0e8ffdf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tools/build-wasm-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ use xshell::{cmd, Shell};
#[derive(Parser, Debug)]
struct Args {
/// Examples to build
#[clap(value_parser)]
examples: Vec<String>,

#[clap(short, long)]
#[clap(short, long, value_parser)]
/// Run tests
test: bool,

#[clap(short, long)]
#[clap(short, long, value_parser)]
/// Run on the given browsers. By default, chromium, firefox, webkit
browsers: Vec<String>,

#[clap(short, long)]
#[clap(short, long, value_parser)]
/// Stop after this number of frames
frames: Option<usize>,
}
Expand Down
8 changes: 5 additions & 3 deletions tools/spancmp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ mod pretty;

#[derive(Parser, Debug)]
struct Args {
#[clap(short, long, default_value_t = 0.0)]
#[clap(short, long, value_parser, default_value_t = 0.0)]
/// Filter spans that have an average shorther than the threshold
threshold: f32,

#[clap(short, long)]
#[clap(short, long, value_parser)]
/// Filter spans by name matching the pattern
pattern: Option<Regex>,

#[clap(short, long)]
#[clap(short, long, value_parser)]
/// Simplify system names
short: bool,

#[clap(value_parser)]
trace: String,
/// Optional, second trace to compare
#[clap(value_parser)]
second_trace: Option<String>,
}

Expand Down

0 comments on commit 0e8ffdf

Please sign in to comment.