pub fn run() -> sc_cli::Result<()> {
	let cli = Cli::from_args();

	match &cli.subcommand {
		Some(Subcommand::Key(cmd)) => cmd.run(&cli),
		Some(Subcommand::BuildSpec(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
		},
		Some(Subcommand::CheckBlock(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, import_queue, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, import_queue), task_manager))
			})
		},
		Some(Subcommand::ExportBlocks(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?;
				Ok((cmd.run(client, config.database), task_manager))
			})
		},
		Some(Subcommand::ExportState(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?;
				Ok((cmd.run(client, config.chain_spec), task_manager))
			})
		},
		Some(Subcommand::ImportBlocks(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, import_queue, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, import_queue), task_manager))
			})
		},
		Some(Subcommand::PurgeChain(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run(config.database))
		},
		Some(Subcommand::Revert(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, backend, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, backend), task_manager))
			})
		},
		#[cfg(feature = "frame-benchmarking")]
		Some(Subcommand::Benchmark(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run::<Block, local::Executor>(config))
		},
		None => {
			let runner = cli.create_runner(&cli.run)?;
			runner.run_node_until_exit(|config| async move {
				local::start_node(config).map_err(sc_cli::Error::Service)
			})
		},
	}
}
/// Parse and run command line arguments
Parse and run command line arguments
Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> {
	let cli = Cli::from_args();
	match &cli.subcommand {
		Some(Subcommand::Key(cmd)) => cmd.run(&cli),
		Some(Subcommand::BuildSpec(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
		},
		Some(Subcommand::CheckBlock(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, import_queue, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, import_queue), task_manager))
			})
		},
		Some(Subcommand::ExportBlocks(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?;
				Ok((cmd.run(client, config.database), task_manager))
			})
		},
		Some(Subcommand::ExportState(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?;
				Ok((cmd.run(client, config.chain_spec), task_manager))
			})
		},
		Some(Subcommand::ImportBlocks(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, import_queue, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, import_queue), task_manager))
			})
		},
		Some(Subcommand::PurgeChain(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run(config.database))
		},
		Some(Subcommand::Revert(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.async_run(|config| {
				let PartialComponents { client, task_manager, backend, .. } =
					service::new_partial(&config)?;
				Ok((cmd.run(client, backend), task_manager))
			})
		},
		#[cfg(feature = "frame-benchmarking")]
		Some(Subcommand::Benchmark(cmd)) => {
			let runner = cli.create_runner(cmd)?;
			runner.sync_run(|config| cmd.run::<Block, local::Executor>(config))
		},
		None => {
			let runner = cli.create_runner(&cli.run)?;
			runner.run_node_until_exit(|config| async move {
				local::start_node(config).map_err(sc_cli::Error::Service)
			})
		},
	}
}
pub fn run ( ) -> sc_cli :: Result < ( ) > { let cli = Cli :: from_args ( ) ; match & cli . subcommand { Some ( Subcommand :: Key ( cmd ) ) => cmd . run ( & cli ) , Some ( Subcommand :: BuildSpec ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . sync_run ( | config | cmd . run ( config . chain_spec , config . network ) ) } , Some ( Subcommand :: CheckBlock ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . async_run ( | config | { let PartialComponents { client , task_manager , import_queue , .. } = service :: new_partial ( & config ) ? ; Ok ( ( cmd . run ( client , import_queue ) , task_manager ) ) } ) } , Some ( Subcommand :: ExportBlocks ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . async_run ( | config | { let PartialComponents { client , task_manager , .. } = service :: new_partial ( & config ) ? ; Ok ( ( cmd . run ( client , config . database ) , task_manager ) ) } ) } , Some ( Subcommand :: ExportState ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . async_run ( | config | { let PartialComponents { client , task_manager , .. } = service :: new_partial ( & config ) ? ; Ok ( ( cmd . run ( client , config . chain_spec ) , task_manager ) ) } ) } , Some ( Subcommand :: ImportBlocks ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . async_run ( | config | { let PartialComponents { client , task_manager , import_queue , .. } = service :: new_partial ( & config ) ? ; Ok ( ( cmd . run ( client , import_queue ) , task_manager ) ) } ) } , Some ( Subcommand :: PurgeChain ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . sync_run ( | config | cmd . run ( config . database ) ) } , Some ( Subcommand :: Revert ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . async_run ( | config | { let PartialComponents { client , task_manager , backend , .. } = service :: new_partial ( & config ) ? ; Ok ( ( cmd . run ( client , backend ) , task_manager ) ) } ) } , # [ cfg ( feature " " ) ] Some ( Subcommand :: Benchmark ( cmd ) ) => { let runner = cli . create_runner ( cmd ) ? ; runner . sync_run ( | config | cmd . run :: < Block , local :: Executor > ( config ) ) } , None => { let runner = cli . create_runner ( & cli . run ) ? ; runner . run_node_until_exit ( | config | async move { local :: start_node ( config ) . map_err ( sc_cli :: Error :: Service ) } ) } , } }
Parse and run command line arguments
Parse and run command line arguments