-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.rs
43 lines (39 loc) · 1.16 KB
/
commands.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mod prove;
mod service;
use self::{prove::ProveCommand, service::ServiceCommand};
use anyhow::Result;
use clap::Parser;
use log::*;
use tendermintx::config::TendermintConfig;
#[derive(Debug, Parser)]
pub struct Cli {
#[clap(subcommand)]
pub command: Command,
}
impl Cli {
pub async fn run(self) -> Result<()> {
debug!("Running command: {:?}", self.command);
debug!(
"CHAIN_ID_BYTES: {:?}({:?})",
crate::config::ChainConfig::CHAIN_ID_BYTES,
String::from_utf8(crate::config::ChainConfig::CHAIN_ID_BYTES.to_vec())
);
debug!("SKIP_MAX: {}", crate::config::ChainConfig::SKIP_MAX);
debug!(
"MAX_VALIDATOR_SET_SIZE: {}",
crate::config::MAX_VALIDATOR_SET_SIZE
);
match self.command {
Command::Prove(prove) => prove.run().await?,
Command::Service(service) => service.run().await?,
}
Ok(())
}
}
#[derive(Debug, Parser)]
pub enum Command {
#[clap(display_order = 1, about = "Prove subcommands")]
Prove(ProveCommand),
#[clap(display_order = 2, about = "Service subcommands")]
Service(ServiceCommand),
}