Skip to content

Commit

Permalink
Replace parse_and_execute with parse_and_prepare (paritytech#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored and gavofyork committed Aug 15, 2019
1 parent 4d0f6d4 commit 05f27b6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ struct ValidationWokerCommand {
pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
W: Worker,
{
let command = cli::parse_and_execute::<service::Factory, PolkadotSubCommands, NoCustom, _, _, _, _, _>(
load_spec, &version, "parity-polkadot", std::env::args(), worker,
match cli::parse_and_prepare::<PolkadotSubCommands, NoCustom, _>(&version, "parity-polkadot", std::env::args()) {
cli::ParseAndPrepare::Run(cmd) => cmd.run(load_spec, worker,
|worker, _cli_args, _custom_args, mut config| {
info!("{}", version.name);
info!(" version {}", config.full_version());
Expand All @@ -110,14 +110,18 @@ pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
worker
),
}.map_err(|e| format!("{:?}", e))
}),
cli::ParseAndPrepare::BuildSpec(cmd) => cmd.run(load_spec),
cli::ParseAndPrepare::ExportBlocks(cmd) =>
cmd.run::<service::Factory, _, _>(load_spec, worker),
cli::ParseAndPrepare::ImportBlocks(cmd) =>
cmd.run::<service::Factory, _, _>(load_spec, worker),
cli::ParseAndPrepare::PurgeChain(cmd) => cmd.run(load_spec),
cli::ParseAndPrepare::RevertChain(cmd) => cmd.run::<service::Factory, _>(load_spec),
cli::ParseAndPrepare::CustomCommand(PolkadotSubCommands::ValidationWorker(args)) => {
service::run_validation_worker(&args.mem_id)?;
Ok(())
}
)?;

match command {
Some(PolkadotSubCommands::ValidationWorker(args)) => {
service::run_validation_worker(&args.mem_id).map_err(Into::into)
}
_ => Ok(())
}
}

Expand Down

0 comments on commit 05f27b6

Please sign in to comment.