Skip to content

Commit

Permalink
Add more relaxed pallet-name parsing (paritytech#8353)
Browse files Browse the repository at this point in the history
Make it possbible to use the pallet's path name, with `-` separator or crate name with `_` separator.
fixes paritytech#8226
  • Loading branch information
hirschenberger authored Mar 15, 2021
1 parent a107e1f commit fdac8be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/frame/benchmarking-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ mod writer;
use sc_cli::{ExecutionStrategy, WasmExecutionMethod};
use std::fmt::Debug;

// Add a more relaxed parsing for pallet names by allowing pallet directory names with `-` to be used
// like crate names with `_`
fn parse_pallet_name(pallet: &str) -> String {
pallet.replace("-", "_")
}

/// The `benchmark` command used to benchmark FRAME Pallets.
#[derive(Debug, structopt::StructOpt)]
pub struct BenchmarkCmd {
/// Select a FRAME Pallet to benchmark, or `*` for all (in which case `extrinsic` must be `*`).
#[structopt(short, long)]
#[structopt(short, long, parse(from_str = parse_pallet_name))]
pub pallet: String,

/// Select an extrinsic inside the pallet to benchmark, or `*` for all.
Expand Down

0 comments on commit fdac8be

Please sign in to comment.