Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed May 16, 2022
1 parent 8f8c91f commit 83f5895
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ runtime-benchmarks = [
# crates.io
array-bytes = { version = "1.5" }
async-trait = { version = "0.1" }
clap = { version = "3.0", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.3" }
futures = { version = "0.3" }
jsonrpc-core = { version = "18.0" }
log = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }
structopt = { version = "0.3" }
tempfile = { version = "3.2" }

# parachain
Expand Down
44 changes: 22 additions & 22 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
// --- std ---
use std::path::PathBuf;
// --- crates.io ---
use structopt::StructOpt;
use clap::{AppSettings, Parser};
// --- darwinia-network ---
use crate::chain_spec;

/// Sub-commands supported by the collator.
#[derive(Debug, StructOpt)]
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Export the genesis state of the parachain.
#[structopt(name = "export-genesis-state")]
#[clap(name = "export-genesis-state")]
ExportGenesisState(ExportGenesisStateCommand),

/// Export the genesis wasm of the parachain.
#[structopt(name = "export-genesis-wasm")]
#[clap(name = "export-genesis-wasm")]
ExportGenesisWasm(ExportGenesisWasmCommand),

/// Build a chain specification.
Expand Down Expand Up @@ -69,52 +69,52 @@ pub enum Subcommand {
}

/// Command for exporting the genesis state of the parachain
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[structopt(parse(from_os_str))]
#[clap(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[structopt(long)]
#[clap(long)]
pub raw: bool,

/// The name of the chain for that the genesis state should be exported.
#[structopt(long)]
#[clap(long)]
pub chain: Option<String>,
}

/// Command for exporting the genesis wasm file.
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[structopt(parse(from_os_str))]
#[clap(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[structopt(short, long)]
#[clap(short, long)]
pub raw: bool,

/// The name of the chain for that the genesis wasm file should be exported.
#[structopt(long)]
#[clap(long)]
pub chain: Option<String>,
}

#[derive(Debug, StructOpt)]
#[structopt(settings = &[
structopt::clap::AppSettings::GlobalVersion,
structopt::clap::AppSettings::ArgsNegateSubcommands,
structopt::clap::AppSettings::SubcommandsNegateReqs,
])]
#[derive(Debug, Parser)]
#[clap(setting(
AppSettings::PropagateVersion |
AppSettings::ArgsNegateSubcommands |
AppSettings::SubcommandsNegateReqs,
))]
pub struct Cli {
#[structopt(subcommand)]
#[clap(subcommand)]
pub subcommand: Option<Subcommand>,

#[structopt(flatten)]
#[clap(flatten)]
pub run: cumulus_client_cli::RunCmd,

/// Relay chain arguments
#[structopt(raw = true)]
#[clap(raw = true)]
pub relay_chain_args: Vec<String>,
}

Expand Down Expand Up @@ -144,7 +144,7 @@ impl RelayChainCli {
Self {
base_path,
chain_id,
base: polkadot_cli::RunCmd::from_iter(relay_chain_args),
base: polkadot_cli::RunCmd::parse_from(relay_chain_args),
}
}
}

0 comments on commit 83f5895

Please sign in to comment.