staging_node_inspect/cli.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Structs to easily compose inspect sub-command for CLI.
20
21use sc_cli::{ImportParams, SharedParams};
22
23/// The `inspect` command used to print decoded chain data.
24#[derive(Debug, clap::Parser)]
25pub struct InspectCmd {
26 #[allow(missing_docs)]
27 #[clap(subcommand)]
28 pub command: InspectSubCmd,
29
30 #[allow(missing_docs)]
31 #[clap(flatten)]
32 pub shared_params: SharedParams,
33
34 #[allow(missing_docs)]
35 #[clap(flatten)]
36 pub import_params: ImportParams,
37}
38
39/// A possible inspect sub-commands.
40#[derive(Debug, clap::Subcommand)]
41pub enum InspectSubCmd {
42 /// Decode block with native version of runtime and print out the details.
43 Block {
44 /// Address of the block to print out.
45 ///
46 /// Can be either a block hash (no 0x prefix) or a number to retrieve existing block,
47 /// or a 0x-prefixed bytes hex string, representing SCALE encoding of
48 /// a block.
49 #[arg(value_name = "HASH or NUMBER or BYTES")]
50 input: String,
51 },
52 /// Decode extrinsic with native version of runtime and print out the details.
53 Extrinsic {
54 /// Address of an extrinsic to print out.
55 ///
56 /// Can be either a block hash (no 0x prefix) or number and the index, in the form
57 /// of `{block}:{index}` or a 0x-prefixed bytes hex string,
58 /// representing SCALE encoding of an extrinsic.
59 #[arg(value_name = "BLOCK:INDEX or BYTES")]
60 input: String,
61 },
62}