minimal_template_node/
cli.rs1use polkadot_sdk::*;
19
20#[derive(Debug, Clone)]
21pub enum Consensus {
22 ManualSeal(u64),
23 InstantSeal,
24 None,
25}
26
27impl std::str::FromStr for Consensus {
28 type Err = String;
29
30 fn from_str(s: &str) -> Result<Self, Self::Err> {
31 Ok(if s == "instant-seal" {
32 Consensus::InstantSeal
33 } else if let Some(block_time) = s.strip_prefix("manual-seal-") {
34 Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
35 } else if s.to_lowercase() == "none" {
36 Consensus::None
37 } else {
38 return Err("incorrect consensus identifier".into());
39 })
40 }
41}
42
43#[derive(Debug, clap::Parser)]
44pub struct Cli {
45 #[command(subcommand)]
46 pub subcommand: Option<Subcommand>,
47
48 #[clap(long, default_value = "manual-seal-3000")]
49 pub consensus: Consensus,
50
51 #[clap(flatten)]
52 pub run: sc_cli::RunCmd,
53}
54
55#[derive(Debug, clap::Subcommand)]
56pub enum Subcommand {
57 #[command(subcommand)]
59 Key(sc_cli::KeySubcommand),
60
61 #[deprecated(
65 note = "build-spec command will be removed after 1/04/2026. Use export-chain-spec command instead"
66 )]
67 BuildSpec(sc_cli::BuildSpecCmd),
68
69 ExportChainSpec(sc_cli::ExportChainSpecCmd),
71
72 CheckBlock(sc_cli::CheckBlockCmd),
74
75 ExportBlocks(sc_cli::ExportBlocksCmd),
77
78 ExportState(sc_cli::ExportStateCmd),
80
81 ImportBlocks(sc_cli::ImportBlocksCmd),
83
84 PurgeChain(sc_cli::PurgeChainCmd),
86
87 Revert(sc_cli::RevertCmd),
89
90 ChainInfo(sc_cli::ChainInfoCmd),
92}