mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 21:31:02 +00:00
Move ExportGenesisStateCommand and ExportGenesisWasmCommand to cumulus-client-cli (#1325)
* Move ExportGenesisStateCommand and ExportGenesisWasmCommand to cumulus-client-cli Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Remove useless Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Use shared_params.chain Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
@@ -14,21 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::chain_spec;
|
||||
use clap::Parser;
|
||||
use sc_cli;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Sub-commands supported by the collator.
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum Subcommand {
|
||||
/// Export the genesis state of the parachain.
|
||||
#[clap(name = "export-genesis-state")]
|
||||
ExportGenesisState(ExportGenesisStateCommand),
|
||||
|
||||
/// Export the genesis wasm of the parachain.
|
||||
#[clap(name = "export-genesis-wasm")]
|
||||
ExportGenesisWasm(ExportGenesisWasmCommand),
|
||||
/// Key management CLI utilities
|
||||
#[clap(subcommand)]
|
||||
Key(sc_cli::KeySubcommand),
|
||||
|
||||
/// Build a chain specification.
|
||||
BuildSpec(sc_cli::BuildSpecCmd),
|
||||
@@ -45,11 +38,17 @@ pub enum Subcommand {
|
||||
/// Import blocks.
|
||||
ImportBlocks(sc_cli::ImportBlocksCmd),
|
||||
|
||||
/// Revert the chain to a previous state.
|
||||
Revert(sc_cli::RevertCmd),
|
||||
|
||||
/// Remove the whole chain.
|
||||
PurgeChain(cumulus_client_cli::PurgeChainCmd),
|
||||
|
||||
/// Revert the chain to a previous state.
|
||||
Revert(sc_cli::RevertCmd),
|
||||
/// Export the genesis state of the parachain.
|
||||
ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand),
|
||||
|
||||
/// Export the genesis wasm of the parachain.
|
||||
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),
|
||||
|
||||
/// Sub-commands concerned with benchmarking.
|
||||
/// The pallet benchmarking moved to the `pallet` sub-command.
|
||||
@@ -58,45 +57,9 @@ pub enum Subcommand {
|
||||
|
||||
/// Try some testing command against a specified runtime state.
|
||||
TryRuntime(try_runtime_cli::TryRuntimeCmd),
|
||||
|
||||
/// Key management CLI utilities
|
||||
#[clap(subcommand)]
|
||||
Key(sc_cli::KeySubcommand),
|
||||
}
|
||||
|
||||
/// Command for exporting the genesis state of the parachain
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ExportGenesisStateCommand {
|
||||
/// Output file name or stdout if unspecified.
|
||||
#[clap(action)]
|
||||
pub output: Option<PathBuf>,
|
||||
|
||||
/// Write output in binary. Default is to write in hex.
|
||||
#[clap(short, long)]
|
||||
pub raw: bool,
|
||||
|
||||
/// The name of the chain for that the genesis state should be exported.
|
||||
#[clap(long)]
|
||||
pub chain: Option<String>,
|
||||
}
|
||||
|
||||
/// Command for exporting the genesis wasm file.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ExportGenesisWasmCommand {
|
||||
/// Output file name or stdout if unspecified.
|
||||
#[clap(action)]
|
||||
pub output: Option<PathBuf>,
|
||||
|
||||
/// Write output in binary. Default is to write in hex.
|
||||
#[clap(short, long)]
|
||||
pub raw: bool,
|
||||
|
||||
/// The name of the chain for that the genesis wasm file should be exported.
|
||||
#[clap(long)]
|
||||
pub chain: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[derive(Debug, clap::Parser)]
|
||||
#[clap(
|
||||
propagate_version = true,
|
||||
args_conflicts_with_subcommands = true,
|
||||
@@ -142,9 +105,9 @@ impl RelayChainCli {
|
||||
para_config: &sc_service::Configuration,
|
||||
relay_chain_args: impl Iterator<Item = &'a String>,
|
||||
) -> Self {
|
||||
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
|
||||
let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec);
|
||||
let chain_id = extension.map(|e| e.relay_chain.clone());
|
||||
let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
||||
Self { base_path, chain_id, base: polkadot_cli::RunCmd::parse_from(relay_chain_args) }
|
||||
Self { base_path, chain_id, base: clap::Parser::parse_from(relay_chain_args) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user