Skip to content

Commit 8f1b832

Browse files
andjo403michaelwoerister
authored andcommitted
Change Cli parser from StructOpt to Clap
1 parent 6b8bc6d commit 8f1b832

File tree

12 files changed

+35
-35
lines changed

12 files changed

+35
-35
lines changed

crox/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ analyzeme = { path = "../analyzeme" }
1010
rustc-hash = "1.0.1"
1111
serde = { version = "1.0", features = [ "derive" ] }
1212
serde_json = "1.0"
13-
structopt = "0.3"
13+
clap = { version = "3.2", features = ["derive"] }

crox/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
77
use analyzeme::{ProfilingData, Timestamp};
88
use measureme::file_header::FILE_EXTENSION;
99

10+
use clap::Parser;
1011
use serde::ser::SerializeSeq;
1112
use serde::{Serialize, Serializer};
1213
use serde_json::json;
1314
use std::cmp;
14-
use structopt::StructOpt;
1515

1616
fn as_micros<S: Serializer>(d: &Duration, s: S) -> Result<S::Ok, S::Error> {
1717
let v = (d.as_secs() * 1_000_000) + (d.subsec_nanos() as u64 / 1_000);
@@ -43,18 +43,18 @@ struct Event {
4343
args: Option<FxHashMap<String, String>>,
4444
}
4545

46-
#[derive(StructOpt, Debug)]
46+
#[derive(Parser, Debug)]
4747
struct Opt {
48-
#[structopt(required_unless = "dir")]
48+
#[clap(required_unless = "dir")]
4949
file_prefix: Vec<PathBuf>,
5050
/// all event trace files in dir will be merged to one chrome_profiler.json file
51-
#[structopt(long = "dir")]
51+
#[clap(long = "dir")]
5252
dir: Option<PathBuf>,
5353
/// collapse threads without overlapping events
54-
#[structopt(long = "collapse-threads")]
54+
#[clap(long = "collapse-threads")]
5555
collapse_threads: bool,
5656
/// filter out events with shorter duration (in microseconds)
57-
#[structopt(long = "minimum-duration")]
57+
#[clap(long = "minimum-duration")]
5858
minimum_duration: Option<u128>,
5959
}
6060

flamegraph/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ license = "MIT OR Apache-2.0"
88
[dependencies]
99
measureme = { path = "../measureme" }
1010
analyzeme = { path = "../analyzeme" }
11-
structopt = "0.3"
11+
clap = { version = "3.2", features = ["derive"] }
1212
inferno = { version="0.9.1", default-features = false }

flamegraph/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ use std::io::BufWriter;
44
use std::path::PathBuf;
55

66
use analyzeme::{collapse_stacks, ProfilingData};
7+
use clap::Parser;
78
use inferno::flamegraph::{from_lines, Options as FlamegraphOptions};
8-
use structopt::StructOpt;
99

10-
#[derive(StructOpt, Debug)]
10+
#[derive(Parser, Debug)]
1111
struct Opt {
1212
file_prefix: PathBuf,
1313
}

mmedit/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ edition = "2018"
66
[dependencies]
77
measureme = { path = "../measureme" }
88
decodeme = { path = "../decodeme" }
9-
structopt = "0.3"
9+
clap = { version = "3.2", features = ["derive"] }

mmedit/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ use std::{convert::TryInto, error::Error, path::PathBuf};
22

33
use decodeme::{read_file_header, PageTag, FILE_HEADER_SIZE, FILE_MAGIC_TOP_LEVEL};
44

5-
use structopt::StructOpt;
5+
use clap::Parser;
66

7-
#[derive(StructOpt, Debug)]
7+
#[derive(Parser, Debug)]
88
struct TruncateOpt {
99
file: PathBuf,
1010
}
1111

12-
#[derive(StructOpt, Debug)]
12+
#[derive(Parser, Debug)]
1313
enum Opt {
1414
/// Truncate to a single page per tag
15-
#[structopt(name = "truncate")]
15+
#[clap(name = "truncate")]
1616
Truncate(TruncateOpt),
1717
}
1818

mmview/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0"
88
[dependencies]
99
analyzeme = { path = "../analyzeme" }
1010
measureme = { path = "../measureme" }
11-
structopt = "0.3"
11+
clap = { version = "3.2", features = ["derive"] }

mmview/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use analyzeme::{Event, EventPayload, ProfilingData, Timestamp};
2+
use clap::Parser;
23
use std::error::Error;
34
use std::path::PathBuf;
45
use std::time::{Duration, SystemTime};
5-
use structopt::StructOpt;
66

7-
#[derive(StructOpt, Debug)]
7+
#[derive(Parser, Debug)]
88
struct Opt {
99
file_prefix: PathBuf,
1010

1111
/// Filter to events which occured on the specified thread id
12-
#[structopt(short = "t", long = "thread-id")]
12+
#[clap(short = 't', long = "thread-id")]
1313
thread_id: Option<u32>,
1414
}
1515

stack_collapse/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0"
88
[dependencies]
99
measureme = { path = "../measureme" }
1010
analyzeme = { path = "../analyzeme" }
11-
structopt = "0.3"
11+
clap = { version = "3.2", features = ["derive"] }

stack_collapse/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::io::{BufWriter, Write};
44
use std::path::PathBuf;
55

66
use analyzeme::{collapse_stacks, ProfilingData};
7-
use structopt::StructOpt;
7+
use clap::Parser;
88

9-
#[derive(StructOpt, Debug)]
9+
#[derive(Parser, Debug)]
1010
struct Opt {
1111
file_prefix: PathBuf,
1212
}

0 commit comments

Comments
 (0)