mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 18:31:05 +00:00
Sort out the subcommand impl
This commit is contained in:
+5
-22
@@ -15,35 +15,18 @@
|
|||||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use sc_cli::{
|
use sc_cli::{
|
||||||
RunCmd,
|
|
||||||
BuildSpecCmd,
|
BuildSpecCmd,
|
||||||
// ExportBlocksCmd, ImportBlocksCmd, CheckBlockCmd, ExportStateCmd, RevertCmd,
|
|
||||||
PurgeChainCmd,
|
PurgeChainCmd,
|
||||||
// Subcommand,
|
RunCmd,
|
||||||
CliConfiguration, SharedParams,
|
|
||||||
};
|
};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
pub enum Subcommand {
|
pub enum Subcommand {
|
||||||
/// Build a spec.json file, outputs to stdout.
|
/// Build a spec.json file, outputs to stdout.
|
||||||
BuildSpec(BuildSpecCmd),
|
BuildSpec(BuildSpecCmd),
|
||||||
/// Export blocks to a file.
|
/// Remove the whole chain data.
|
||||||
// ExportBlocks(ExportBlocksCmd),
|
PurgeChain(PurgeChainCmd),
|
||||||
/// 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!() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
|
|||||||
+12
-16
@@ -16,7 +16,10 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
chain_spec,
|
chain_spec,
|
||||||
cli::{Cli, Subcommand},
|
cli::{
|
||||||
|
Cli,
|
||||||
|
Subcommand,
|
||||||
|
},
|
||||||
service,
|
service,
|
||||||
};
|
};
|
||||||
use sc_cli::{
|
use sc_cli::{
|
||||||
@@ -74,21 +77,14 @@ pub fn run() -> sc_cli::Result<()> {
|
|||||||
let cli = Cli::from_args();
|
let cli = Cli::from_args();
|
||||||
|
|
||||||
match &cli.subcommand {
|
match &cli.subcommand {
|
||||||
Some(Subcommand::BuildSpec(_cmd)) => todo!(),
|
Some(Subcommand::BuildSpec(cmd)) => {
|
||||||
Some(Subcommand::PurgeChain(_cmd)) => todo!(),
|
let runner = cli.create_runner(cmd)?;
|
||||||
// Some(subcommand) => {
|
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||||
// let runner = cli.create_runner(subcommand)?;
|
}
|
||||||
// runner.run_subcommand(subcommand, |config| {
|
Some(Subcommand::PurgeChain(cmd)) => {
|
||||||
// let PartialComponents {
|
let runner = cli.create_runner(cmd)?;
|
||||||
// client,
|
runner.sync_run(|config| cmd.run(config.database))
|
||||||
// backend,
|
}
|
||||||
// task_manager,
|
|
||||||
// import_queue,
|
|
||||||
// ..
|
|
||||||
// } = service::new_partial(&config)?;
|
|
||||||
// Ok((client, backend, import_queue, task_manager))
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run)?;
|
let runner = cli.create_runner(&cli.run)?;
|
||||||
runner.run_node_until_exit(|config| {
|
runner.run_node_until_exit(|config| {
|
||||||
|
|||||||
Reference in New Issue
Block a user