use clap3 instead of structopt (#10632)

* use clap3 instead of structopt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* format

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update ss58-registry and revert some nits

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix clippy and doc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update clap to 3.0.7

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Apply review suggestions

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* remove useless option long name

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* cargo fmt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2022-01-25 00:28:46 +08:00
committed by GitHub
parent d1ff02d31e
commit e327b734bc
66 changed files with 660 additions and 768 deletions
+2 -4
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "3.0", features = ["derive"] }
log = "0.4.8"
node-primitives = { version = "2.0.0", path = "../primitives" }
node-testing = { version = "3.0.0-dev", path = "../testing" }
@@ -18,7 +19,6 @@ sp-runtime = { version = "4.1.0-dev", path = "../../../primitives/runtime" }
sp-state-machine = { version = "0.10.0", path = "../../../primitives/state-machine" }
serde = "1.0.132"
serde_json = "1.0.74"
structopt = "0.3"
derive_more = "0.99.16"
kvdb = "0.10.0"
kvdb-rocksdb = "0.14.0"
@@ -35,9 +35,7 @@ fs_extra = "1"
hex = "0.4.0"
rand = { version = "0.7.2", features = ["small_rng"] }
lazy_static = "1.4.0"
parity-util-mem = { version = "0.10.2", default-features = false, features = [
"primitive-types",
] }
parity-util-mem = { version = "0.10.2", default-features = false, features = ["primitive-types"] }
parity-db = { version = "0.3" }
sc-transaction-pool = { version = "4.0.0-dev", path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../../../client/transaction-pool/api" }
+8 -8
View File
@@ -28,7 +28,7 @@ mod tempdb;
mod trie;
mod txpool;
use structopt::StructOpt;
use clap::Parser;
use node_testing::bench::{BlockType, DatabaseType as BenchDataBaseType, KeyTypes, Profile};
@@ -42,19 +42,19 @@ use crate::{
txpool::PoolBenchmarkDescription,
};
#[derive(Debug, StructOpt)]
#[structopt(name = "node-bench", about = "Node integration benchmarks")]
#[derive(Debug, Parser)]
#[clap(name = "node-bench", about = "Node integration benchmarks")]
struct Opt {
/// Show list of all available benchmarks.
///
/// Will output ("name", "path"). Benchmarks can then be filtered by path.
#[structopt(short, long)]
#[clap(short, long)]
list: bool,
/// Machine readable json output.
///
/// This also suppresses all regular output (except to stderr)
#[structopt(short, long)]
#[clap(short, long)]
json: bool,
/// Filter benchmarks.
@@ -63,7 +63,7 @@ struct Opt {
filter: Option<String>,
/// Number of transactions for block import with `custom` size.
#[structopt(long)]
#[clap(long)]
transactions: Option<usize>,
/// Mode
@@ -72,12 +72,12 @@ struct Opt {
///
/// "profile" mode adds pauses between measurable runs,
/// so that actual interval can be selected in the profiler of choice.
#[structopt(short, long, default_value = "regular")]
#[clap(short, long, default_value = "regular")]
mode: BenchmarkMode,
}
fn main() {
let opt = Opt::from_args();
let opt = Opt::parse();
if !opt.json {
sp_tracing::try_init_simple();