mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
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:
@@ -293,7 +293,7 @@ pub(crate) mod parse;
|
||||
pub(crate) const LOG_TARGET: &'static str = "try-runtime::cli";
|
||||
|
||||
/// Possible commands of `try-runtime`.
|
||||
#[derive(Debug, Clone, structopt::StructOpt)]
|
||||
#[derive(Debug, Clone, clap::Subcommand)]
|
||||
pub enum Command {
|
||||
/// Execute the migrations of the "local runtime".
|
||||
///
|
||||
@@ -373,70 +373,64 @@ pub enum Command {
|
||||
}
|
||||
|
||||
/// Shared parameters of the `try-runtime` commands
|
||||
#[derive(Debug, Clone, structopt::StructOpt)]
|
||||
#[derive(Debug, Clone, clap::Parser)]
|
||||
pub struct SharedParams {
|
||||
/// Shared parameters of substrate cli.
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
#[clap(flatten)]
|
||||
pub shared_params: sc_cli::SharedParams,
|
||||
|
||||
/// The execution strategy that should be used.
|
||||
#[structopt(
|
||||
long = "execution",
|
||||
value_name = "STRATEGY",
|
||||
possible_values = &ExecutionStrategy::variants(),
|
||||
case_insensitive = true,
|
||||
default_value = "Wasm",
|
||||
)]
|
||||
#[clap(long, value_name = "STRATEGY", arg_enum, ignore_case = true, default_value = "Wasm")]
|
||||
pub execution: ExecutionStrategy,
|
||||
|
||||
/// Type of wasm execution used.
|
||||
#[structopt(
|
||||
#[clap(
|
||||
long = "wasm-execution",
|
||||
value_name = "METHOD",
|
||||
possible_values = &WasmExecutionMethod::variants(),
|
||||
case_insensitive = true,
|
||||
possible_values = WasmExecutionMethod::variants(),
|
||||
ignore_case = true,
|
||||
default_value = "Compiled"
|
||||
)]
|
||||
pub wasm_method: WasmExecutionMethod,
|
||||
|
||||
/// The number of 64KB pages to allocate for Wasm execution. Defaults to
|
||||
/// [`sc_service::Configuration.default_heap_pages`].
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub heap_pages: Option<u64>,
|
||||
|
||||
/// When enabled, the spec name check will not panic, and instead only show a warning.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub no_spec_name_check: bool,
|
||||
}
|
||||
|
||||
/// Our `try-runtime` command.
|
||||
///
|
||||
/// See [`Command`] for more info.
|
||||
#[derive(Debug, Clone, structopt::StructOpt)]
|
||||
#[derive(Debug, Clone, clap::Parser)]
|
||||
pub struct TryRuntimeCmd {
|
||||
#[structopt(flatten)]
|
||||
#[clap(flatten)]
|
||||
pub shared: SharedParams,
|
||||
|
||||
#[structopt(subcommand)]
|
||||
#[clap(subcommand)]
|
||||
pub command: Command,
|
||||
}
|
||||
|
||||
/// The source of runtime *state* to use.
|
||||
#[derive(Debug, Clone, structopt::StructOpt)]
|
||||
#[derive(Debug, Clone, clap::Subcommand)]
|
||||
pub enum State {
|
||||
/// Use a state snapshot as the source of runtime state.
|
||||
///
|
||||
/// This can be crated by passing a value to [`State::Live::snapshot_path`].
|
||||
Snap {
|
||||
#[structopt(short, long)]
|
||||
#[clap(short, long)]
|
||||
snapshot_path: PathBuf,
|
||||
},
|
||||
|
||||
/// Use a live chain as the source of runtime state.
|
||||
Live {
|
||||
/// The url to connect to.
|
||||
#[structopt(
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
parse(try_from_str = parse::url),
|
||||
@@ -447,20 +441,20 @@ pub enum State {
|
||||
///
|
||||
/// If non provided, then the latest finalized head is used. This is particularly useful
|
||||
/// for [`Command::OnRuntimeUpgrade`].
|
||||
#[structopt(
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
multiple = false,
|
||||
multiple_values = false,
|
||||
parse(try_from_str = parse::hash),
|
||||
)]
|
||||
at: Option<String>,
|
||||
|
||||
/// An optional state snapshot file to WRITE to. Not written if set to `None`.
|
||||
#[structopt(short, long)]
|
||||
#[clap(short, long)]
|
||||
snapshot_path: Option<PathBuf>,
|
||||
|
||||
/// The pallets to scrape. If empty, entire chain state will be scraped.
|
||||
#[structopt(short, long, require_delimiter = true)]
|
||||
#[clap(short, long, require_delimiter = true)]
|
||||
pallets: Option<Vec<String>>,
|
||||
|
||||
/// Fetch the child-keys as well.
|
||||
@@ -468,7 +462,7 @@ pub enum State {
|
||||
/// Default is `false`, if specific `pallets` are specified, true otherwise. In other
|
||||
/// words, if you scrape the whole state the child tree data is included out of the box.
|
||||
/// Otherwise, it must be enabled explicitly using this flag.
|
||||
#[structopt(long, require_delimiter = true)]
|
||||
#[clap(long, require_delimiter = true)]
|
||||
child_tree: bool,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user