diff --git a/test-node/src/cli.rs b/test-node/src/cli.rs index 195f9075ec..c2935beb1a 100644 --- a/test-node/src/cli.rs +++ b/test-node/src/cli.rs @@ -15,35 +15,18 @@ // along with substrate-subxt. If not, see . use sc_cli::{ - RunCmd, BuildSpecCmd, - // ExportBlocksCmd, ImportBlocksCmd, CheckBlockCmd, ExportStateCmd, RevertCmd, PurgeChainCmd, - // Subcommand, - CliConfiguration, SharedParams, + RunCmd, }; use structopt::StructOpt; #[derive(Debug, StructOpt)] pub enum Subcommand { - /// Build a spec.json file, outputs to stdout. - BuildSpec(BuildSpecCmd), - /// Export blocks to a file. - // ExportBlocks(ExportBlocksCmd), - /// Import blocks from file. - // ImportBlocks(ImportBlocksCmd), - /// Validate a single block. - // CheckBlock(CheckBlockCmd), - /// Export state as raw chain spec. - // ExportState(ExportStateCmd), - /// Revert chain to the previous state. - // Revert(RevertCmd), - /// Remove the whole chain data. - PurgeChain(PurgeChainCmd), -} - -impl CliConfiguration for Subcommand { - fn shared_params(&self) -> &SharedParams { todo!() } + /// Build a spec.json file, outputs to stdout. + BuildSpec(BuildSpecCmd), + /// Remove the whole chain data. + PurgeChain(PurgeChainCmd), } #[derive(Debug, StructOpt)] diff --git a/test-node/src/command.rs b/test-node/src/command.rs index 850c39d80c..14aef05638 100644 --- a/test-node/src/command.rs +++ b/test-node/src/command.rs @@ -16,7 +16,10 @@ use crate::{ chain_spec, - cli::{Cli, Subcommand}, + cli::{ + Cli, + Subcommand, + }, service, }; use sc_cli::{ @@ -74,21 +77,14 @@ pub fn run() -> sc_cli::Result<()> { let cli = Cli::from_args(); match &cli.subcommand { - Some(Subcommand::BuildSpec(_cmd)) => todo!(), - Some(Subcommand::PurgeChain(_cmd)) => todo!(), - // Some(subcommand) => { - // let runner = cli.create_runner(subcommand)?; - // runner.run_subcommand(subcommand, |config| { - // let PartialComponents { - // client, - // backend, - // task_manager, - // import_queue, - // .. - // } = service::new_partial(&config)?; - // Ok((client, backend, import_queue, task_manager)) - // }) - // } + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) + } + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.database)) + } None => { let runner = cli.create_runner(&cli.run)?; runner.run_node_until_exit(|config| {