cli.rs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // This file is part of Substrate.
  2. // Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
  3. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. // You should have received a copy of the GNU General Public License
  13. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. use sc_cli::{KeySubcommand, RunCmd, SignCmd, VanityCmd, VerifyCmd};
  15. use structopt::StructOpt;
  16. /// An overarching CLI command definition.
  17. #[derive(Debug, StructOpt)]
  18. pub struct Cli {
  19. /// Possible subcommand with parameters.
  20. #[structopt(subcommand)]
  21. pub subcommand: Option<Subcommand>,
  22. #[allow(missing_docs)]
  23. #[structopt(flatten)]
  24. pub run: RunCmd,
  25. }
  26. /// Possible subcommands of the main binary.
  27. #[derive(Debug, StructOpt)]
  28. pub enum Subcommand {
  29. /// Key management cli utilities
  30. Key(KeySubcommand),
  31. /// The custom inspect subcommmand for decoding blocks and extrinsics.
  32. #[structopt(
  33. name = "inspect",
  34. about = "Decode given block or extrinsic using current native runtime."
  35. )]
  36. Inspect(node_inspect::cli::InspectCmd),
  37. /// The custom benchmark subcommmand benchmarking runtime pallets.
  38. #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
  39. Benchmark(frame_benchmarking_cli::BenchmarkCmd),
  40. /// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
  41. Verify(VerifyCmd),
  42. /// Generate a seed that provides a vanity address.
  43. Vanity(VanityCmd),
  44. /// Sign a message, with a given (secret) key.
  45. Sign(SignCmd),
  46. /// Build a chain specification.
  47. BuildSpec(sc_cli::BuildSpecCmd),
  48. /// Build a chain specification with a light client sync state.
  49. BuildSyncSpec(sc_cli::BuildSyncSpecCmd),
  50. /// Validate blocks.
  51. CheckBlock(sc_cli::CheckBlockCmd),
  52. /// Export blocks.
  53. ExportBlocks(sc_cli::ExportBlocksCmd),
  54. /// Export the state of a given block into a chain spec.
  55. ExportState(sc_cli::ExportStateCmd),
  56. /// Import blocks.
  57. ImportBlocks(sc_cli::ImportBlocksCmd),
  58. /// Remove the whole chain.
  59. PurgeChain(sc_cli::PurgeChainCmd),
  60. /// Revert the chain to a previous state.
  61. Revert(sc_cli::RevertCmd),
  62. }