use sc_cli::RunCmd;
use crate::chain_spec;
use sc_cli::{ SubstrateCli};
use crate::command::{BootstrapChainCmd, BootstrapNodeCmd, ConvertChainspecToRawCmd};
use crate::evm_tracing_types::EthApiOptions;
#[derive(Debug, clap::Parser)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[clap(flatten)]
pub phron: crate::phron_cli::PhronCli,
#[clap(flatten)]
pub run: RunCmd,
#[clap(long)]
pub no_hardware_benchmarks: bool,
#[allow(missing_docs)]
#[clap(flatten)]
pub evm_tracing: EthApiOptions,
}
#[derive(Debug, clap::Subcommand)]
#[allow(clippy::large_enum_variant)]
pub enum Subcommand {
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
BootstrapChain(BootstrapChainCmd),
BootstrapNode(BootstrapNodeCmd),
ConvertChainspecToRaw(ConvertChainspecToRawCmd),
BuildSpec(sc_cli::BuildSpecCmd),
CheckBlock(sc_cli::CheckBlockCmd),
ExportBlocks(sc_cli::ExportBlocksCmd),
ExportState(sc_cli::ExportStateCmd),
ImportBlocks(sc_cli::ImportBlocksCmd),
PurgeChain(sc_cli::PurgeChainCmd),
Revert(sc_cli::RevertCmd),
#[cfg(feature = "runtime-benchmarks")]
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
TryRuntime,
ChainInfo(sc_cli::ChainInfoCmd),
}
impl SubstrateCli for Cli {
fn impl_name() -> String {
"Substrate Node".into()
}
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}
fn description() -> String {
env!("CARGO_PKG_DESCRIPTION").into()
}
fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}
fn support_url() -> String {
"support.anonymous.an".into()
}
fn copyright_start_year() -> i32 {
2017
}
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::devnet_config()?),
"" | "local" => Box::new(chain_spec::local_config()?),
"live" => Box::new(chain_spec::mainnet_config()?),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
}
}