Improve Client CLI help readability (#2073)

Currently the CLI `-h/--help` commad output is almost unreadable as (for
some commands) it:
- doesn't provide a short brief of what the command does.
- doesn't separate the options description in smaller paragraphs.
- doesn't use a smart wrap strategy for lines longer than the number of
columns in the terminal.

Follow some pics taken with a 100 cols wide term

## Short help (./node -h)

### Before


![20231028-174531-grim](https://github.com/paritytech/polkadot-sdk/assets/8143589/11b62c3c-dcd5-43f4-ac58-f1b299e3f4b9)

### After


![20231028-175041-grim](https://github.com/paritytech/polkadot-sdk/assets/8143589/dc08f6fd-b287-40fb-8b33-71a185922104)


## Long help (./node --help)

### Before


![20231028-175257-grim](https://github.com/paritytech/polkadot-sdk/assets/8143589/9ebdc0ae-54ee-4760-b873-a7e813523cb6)

### After


![20231028-175155-grim](https://github.com/paritytech/polkadot-sdk/assets/8143589/69cbe5cb-eb2f-46a5-8ebf-76c0cf8c4bad)

---------

Co-authored-by: command-bot <>
This commit is contained in:
Davide Galassi
2023-10-29 18:25:33 +01:00
committed by GitHub
parent 8ce16ee6ff
commit 7035034710
16 changed files with 190 additions and 97 deletions
@@ -25,12 +25,14 @@ 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).
///
/// 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"])]
@@ -40,14 +42,23 @@ pub struct SharedParams {
#[arg(long, short = 'd', value_name = "PATH")]
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.
/// Sets a custom logging filter (syntax: `<target>=<level>`).
///
/// 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>`.
///
/// Multiple `<target>=<level>` entries can be specified and separated by a comma.
///
/// *Example*: `--log error,sync=debug,grandpa=warn`.
/// Sets Global log level to `error`, sets `sync` target to debug and grandpa target to `warn`.
#[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.
///
/// 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,
@@ -57,14 +68,18 @@ 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)]
pub enable_log_reloading: bool,
/// Sets a custom profiling filter. Syntax is the same as for logging: `<target>=<level>`.
/// Sets a custom profiling filter.
///
/// Syntax is the same as for logging (`--log`).
#[arg(long, value_name = "TARGETS")]
pub tracing_targets: Option<String>,