chore(cli): make cli display docs correctly (#14017)

* chore(cli): make cli display docs correctly

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
This commit is contained in:
yjh
2023-04-27 18:34:15 +08:00
committed by GitHub
parent ac6e43e628
commit 31e1329da0
17 changed files with 8 additions and 94 deletions
@@ -52,15 +52,11 @@ pub struct ImportParams {
pub wasm_method: WasmExecutionMethod,
/// The WASM instantiation method to use.
///
/// Only has an effect when `wasm-execution` is set to `compiled`.
///
/// The copy-on-write strategies are only supported on Linux.
/// If the copy-on-write variant of a strategy is unsupported
/// the executor will fall back to the non-CoW equivalent.
///
/// The fastest (and the default) strategy available is `pooling-copy-on-write`.
///
/// The `legacy-instance-reuse` strategy is deprecated and will
/// be removed in the future. It should only be used in case of
/// issues with the default instantiation strategy.
@@ -73,7 +69,6 @@ pub struct ImportParams {
pub wasmtime_instantiation_strategy: WasmtimeInstantiationStrategy,
/// Specify the path where local WASM runtimes are stored.
///
/// These runtimes will override on-chain runtimes when the version matches.
#[arg(long, value_name = "PATH")]
pub wasm_runtime_overrides: Option<PathBuf>,
@@ -83,13 +78,11 @@ pub struct ImportParams {
pub execution_strategies: ExecutionStrategiesParams,
/// Specify the state cache size.
///
/// Providing `0` will disable the cache.
#[arg(long, value_name = "Bytes", default_value_t = 67108864)]
pub trie_cache_size: usize,
/// DEPRECATED
///
/// Switch to `--trie-cache-size`.
#[arg(long)]
state_cache_size: Option<usize>,
@@ -42,9 +42,7 @@ pub struct NetworkParams {
pub reserved_nodes: Vec<MultiaddrWithPeerId>,
/// Whether to only synchronize the chain with reserved nodes.
///
/// Also disables automatic peer discovery.
///
/// TCP connections might still be established with non-reserved nodes.
/// In particular, if you are a validator your node might still connect to other
/// validator nodes and collator nodes regardless of whether they are defined as
@@ -95,14 +93,12 @@ pub struct NetworkParams {
pub in_peers_light: u32,
/// Disable mDNS discovery.
///
/// By default, the network will use mDNS to discover other nodes on the
/// local network. This disables it. Automatically implied when using --dev.
#[arg(long)]
pub no_mdns: bool,
/// Maximum number of peers from which to ask for the same blocks in parallel.
///
/// This allows downloading announced blocks from multiple peers. Decrease to save
/// traffic and risk increased latency.
#[arg(long, value_name = "COUNT", default_value_t = 5)]
@@ -113,7 +109,6 @@ pub struct NetworkParams {
pub node_key_params: NodeKeyParams,
/// Enable peer discovery on local networks.
///
/// By default this option is `true` for `--dev` or when the chain type is
/// `Local`/`Development` and false otherwise.
#[arg(long)]
@@ -121,7 +116,6 @@ pub struct NetworkParams {
/// Require iterative Kademlia DHT queries to use disjoint paths for increased resiliency in
/// the presence of potentially adversarial nodes.
///
/// See the S/Kademlia paper for more information on the high level design as well as its
/// security improvements.
#[arg(long)]
@@ -33,16 +33,12 @@ const NODE_KEY_ED25519_FILE: &str = "secret_ed25519";
#[derive(Debug, Clone, Args)]
pub struct NodeKeyParams {
/// The secret key to use for libp2p networking.
///
/// The value is a string that is parsed according to the choice of
/// `--node-key-type` as follows:
///
/// `ed25519`:
/// The value is parsed as a hex-encoded Ed25519 32 byte secret key,
/// i.e. 64 hex characters.
///
/// The value of this option takes precedence over `--node-key-file`.
///
/// WARNING: Secrets provided as command-line arguments are easily exposed.
/// Use of this option should be limited to development and testing. To use
/// an externally managed secret key, use `--node-key-file` instead.
@@ -50,33 +46,25 @@ pub struct NodeKeyParams {
pub node_key: Option<String>,
/// The type of secret key to use for libp2p networking.
///
/// The secret key of the node is obtained as follows:
///
/// * If the `--node-key` option is given, the value is parsed as a secret key according to
/// the type. See the documentation for `--node-key`.
///
/// * If the `--node-key-file` option is given, the secret key is read from the specified
/// file. See the documentation for `--node-key-file`.
///
/// * Otherwise, the secret key is read from a file with a predetermined, type-specific name
/// from the chain-specific network config directory inside the base directory specified by
/// `--base-dir`. If this file does not exist, it is created with a newly generated secret
/// key of the chosen type.
///
/// The node's secret key determines the corresponding public key and hence the
/// node's peer ID in the context of libp2p.
#[arg(long, value_name = "TYPE", value_enum, ignore_case = true, default_value_t = NodeKeyType::Ed25519)]
pub node_key_type: NodeKeyType,
/// The file from which to read the node's secret key to use for libp2p networking.
///
/// The contents of the file are parsed according to the choice of `--node-key-type`
/// as follows:
///
/// `ed25519`:
/// The file must contain an unencoded 32 byte or hex encoded Ed25519 secret key.
///
/// If the file does not exist, it is created with a newly generated secret key of
/// the chosen type.
#[arg(long, value_name = "FILE")]
@@ -33,7 +33,6 @@ use crate::{error, OffchainWorkerEnabled};
#[derive(Debug, Clone, Args)]
pub struct OffchainWorkerParams {
/// Should execute offchain workers on every block.
///
/// By default it's only enabled for nodes that are authoring new blocks.
#[arg(
long = "offchain-worker",
@@ -45,9 +44,7 @@ pub struct OffchainWorkerParams {
pub enabled: OffchainWorkerEnabled,
/// Enable Offchain Indexing API, which allows block import to write to Offchain DB.
///
/// Enables a runtime to write directly to a offchain workers
/// DB during block import.
/// Enables a runtime to write directly to a offchain workers DB during block import.
#[arg(long = "enable-offchain-indexing", value_name = "ENABLE_OFFCHAIN_INDEXING", default_value_t = false, action = ArgAction::Set)]
pub indexing_enabled: bool,
}
@@ -27,12 +27,10 @@ pub struct PrometheusParams {
#[arg(long, value_name = "PORT")]
pub prometheus_port: Option<u16>,
/// Expose Prometheus exporter on all interfaces.
///
/// Default is local.
#[arg(long)]
pub prometheus_external: bool,
/// Do not expose a Prometheus exporter endpoint.
///
/// Prometheus metric endpoint is enabled by default.
#[arg(long)]
pub no_prometheus: bool,
@@ -24,48 +24,26 @@ use sc_service::{BlocksPruning, PruningMode};
#[derive(Debug, Clone, Args)]
pub struct PruningParams {
/// Specify the state pruning mode.
///
/// This mode specifies when the block's state (ie, storage)
/// should be pruned (ie, removed) from the database.
///
/// This setting can only be set on the first creation of the database. Every subsequent run
/// will load the pruning mode from the database and will error if the stored mode doesn't
/// match this CLI value. It is fine to drop this CLI flag for subsequent runs.
///
/// Possible values:
///
/// - archive:
///
/// Keep the state of all blocks.
///
/// - 'archive-canonical'
///
/// Keep only the state of finalized blocks.
///
/// - number
///
/// Keep the state of the last number of finalized blocks.
///
/// - archive: Keep the state of all blocks.
/// - 'archive-canonical' Keep only the state of finalized blocks.
/// - number Keep the state of the last number of finalized blocks.
/// [default: 256]
#[arg(alias = "pruning", long, value_name = "PRUNING_MODE")]
pub state_pruning: Option<DatabasePruningMode>,
/// Specify the blocks pruning mode.
///
/// This mode specifies when the block's body (including justifications)
/// should be pruned (ie, removed) from the database.
///
/// Possible values:
/// - 'archive'
///
/// Keep all blocks.
///
/// - 'archive-canonical'
///
/// Keep only finalized blocks.
///
/// - 'archive' Keep all blocks.
/// - 'archive-canonical' Keep only finalized blocks.
/// - number
///
/// Keep the last `number` of finalized blocks.
#[arg(
alias = "keep-blocks",
@@ -25,14 +25,12 @@ use std::path::PathBuf;
#[derive(Debug, Clone, Args)]
pub struct SharedParams {
/// Specify the chain specification.
///
/// It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file
/// with the chainspec (such as one exported by the `build-spec` subcommand).
#[arg(long, value_name = "CHAIN_SPEC")]
pub chain: Option<String>,
/// Specify the development chain.
///
/// This flag sets `--chain=dev`, `--force-authoring`, `--rpc-cors=all`,
/// `--alice`, and `--tmp` flags, unless explicitly overridden.
#[arg(long, conflicts_with_all = &["chain"])]
@@ -43,16 +41,13 @@ pub struct SharedParams {
pub base_path: Option<PathBuf>,
/// Sets a custom logging filter. Syntax is `<target>=<level>`, e.g. -lsync=debug.
///
/// Log levels (least to most verbose) are error, warn, info, debug, and trace.
/// By default, all targets log `info`. The global log level can be set with `-l<level>`.
#[arg(short = 'l', long, value_name = "LOG_PATTERN", num_args = 1..)]
pub log: Vec<String>,
/// Enable detailed log output.
///
/// This includes displaying the log target, log level and thread name.
///
/// This is automatically enabled when something is logged with any higher level than `info`.
#[arg(long)]
pub detailed_log_output: bool,
@@ -62,10 +57,8 @@ pub struct SharedParams {
pub disable_log_color: bool,
/// Enable feature to dynamically update and reload the log filter.
///
/// Be aware that enabling this feature can lead to a performance decrease up to factor six or
/// more. Depending on the global logging level the performance decrease changes.
///
/// The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this
/// option not being set.
#[arg(long)]
@@ -22,13 +22,11 @@ use clap::Args;
#[derive(Debug, Clone, Args)]
pub struct TelemetryParams {
/// Disable connecting to the Substrate telemetry server.
///
/// Telemetry is on by default on global chains.
#[arg(long)]
pub no_telemetry: bool,
/// The URL of the telemetry server to connect to.
///
/// This flag can be passed multiple times as a means to specify multiple
/// telemetry endpoints. Verbosity levels range from 0-9, with 0 denoting
/// the least verbosity.