Update clap requirement from 3.2 to 4.0 (#6303)

# Objective

Alternative to #6150

Dependabot's PR doesn't seem to break anything, but there are some deprecations that we might as well fix up.

## Solution

https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#migrating

Update clap in `build-wasm-example` and `span-cmp`. Other tools don't use clap.

Remove references to `value_parser`. It's the default now.

Change `#[clap()]` to `#[arg()]`.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Rob Parrett 2022-10-19 18:54:37 +00:00
parent c313e21d65
commit 7db9b08b5f
4 changed files with 8 additions and 11 deletions

View File

@ -9,4 +9,4 @@ license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
xshell = "0.2" xshell = "0.2"
clap = { version = "3.2", features = ["derive"] } clap = { version = "4.0", features = ["derive"] }

View File

@ -6,18 +6,17 @@ use xshell::{cmd, Shell};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
struct Args { struct Args {
/// Examples to build /// Examples to build
#[clap(value_parser)]
examples: Vec<String>, examples: Vec<String>,
#[clap(short, long, value_parser)] #[arg(short, long)]
/// Run tests /// Run tests
test: bool, test: bool,
#[clap(short, long, value_parser)] #[arg(short, long)]
/// Run on the given browsers. By default, chromium, firefox, webkit /// Run on the given browsers. By default, chromium, firefox, webkit
browsers: Vec<String>, browsers: Vec<String>,
#[clap(short, long, value_parser)] #[arg(short, long)]
/// Stop after this number of frames /// Stop after this number of frames
frames: Option<usize>, frames: Option<usize>,
} }

View File

@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
clap = { version = "3.2", features = ["derive"] } clap = { version = "4.0", features = ["derive"] }
regex = "1.5" regex = "1.5"
termcolor = "1.1" termcolor = "1.1"
bevy_utils = { path = "../../crates/bevy_utils", version = "0.9.0-dev" } bevy_utils = { path = "../../crates/bevy_utils", version = "0.9.0-dev" }

View File

@ -15,22 +15,20 @@ mod pretty;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
struct Args { struct Args {
#[clap(short, long, value_parser, default_value_t = 0.0)] #[arg(short, long, default_value_t = 0.0)]
/// Filter spans that have an average shorther than the threshold /// Filter spans that have an average shorther than the threshold
threshold: f32, threshold: f32,
#[clap(short, long, value_parser)] #[arg(short, long)]
/// Filter spans by name matching the pattern /// Filter spans by name matching the pattern
pattern: Option<Regex>, pattern: Option<Regex>,
#[clap(short, long, value_parser)] #[arg(short, long)]
/// Simplify system names /// Simplify system names
short: bool, short: bool,
#[clap(value_parser)]
trace: String, trace: String,
/// Optional, second trace to compare /// Optional, second trace to compare
#[clap(value_parser)]
second_trace: Option<String>, second_trace: Option<String>,
} }