From 0c92aaa95a9692abfd2c7e9654e06c3045545776 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Thu, 4 Apr 2024 21:48:22 +0300 Subject: [PATCH] alphabetic order --- account_manager/src/wallet/create.rs | 16 +++++++---- account_manager/src/wallet/mod.rs | 1 + account_manager/src/wallet/recover.rs | 15 ++++++---- lighthouse/src/main.rs | 11 +++++++- scripts/cli.sh | 3 -- validator_manager/src/move_validators.rs | 36 ++++++++++++++++-------- 6 files changed, 56 insertions(+), 26 deletions(-) diff --git a/account_manager/src/wallet/create.rs b/account_manager/src/wallet/create.rs index 7d7d9720424..12aa5d3801a 100644 --- a/account_manager/src/wallet/create.rs +++ b/account_manager/src/wallet/create.rs @@ -44,7 +44,8 @@ pub fn cli_app() -> Command { "The wallet will be created with this name. It is not allowed to \ create two wallets with the same name for the same --base-dir.", ) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0) ) .arg( Arg::new(PASSWORD_FLAG) @@ -56,7 +57,8 @@ pub fn cli_app() -> Command { saved at that path. To avoid confusion, if the file does not already \ exist it must include a '.pass' suffix.", ) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0) ) .arg( Arg::new(TYPE_FLAG) @@ -68,7 +70,8 @@ pub fn cli_app() -> Command { ) .action(ArgAction::Set) .value_parser([HD_TYPE]) - .default_value(HD_TYPE), + .default_value(HD_TYPE) + .display_order(0) ) .arg( Arg::new(MNEMONIC_FLAG) @@ -78,13 +81,15 @@ pub fn cli_app() -> Command { "If present, the mnemonic will be saved to this file. DO NOT SHARE THE MNEMONIC.", ) .action(ArgAction::Set) + .display_order(0) ) .arg( Arg::new(STDIN_INPUTS_FLAG) .action(ArgAction::SetTrue) .hide(cfg!(windows)) .long(STDIN_INPUTS_FLAG) - .help("If present, read all user inputs from stdin instead of tty."), + .help("If present, read all user inputs from stdin instead of tty.") + .display_order(0) ) .arg( Arg::new(MNEMONIC_LENGTH_FLAG) @@ -109,7 +114,8 @@ pub fn cli_app() -> Command { )), } }) - .default_value("24"), + .default_value("24") + .display_order(0) ) } diff --git a/account_manager/src/wallet/mod.rs b/account_manager/src/wallet/mod.rs index 19ad5713ebe..1a4b55f8764 100644 --- a/account_manager/src/wallet/mod.rs +++ b/account_manager/src/wallet/mod.rs @@ -12,6 +12,7 @@ pub const CMD: &str = "wallet"; pub fn cli_app() -> Command { Command::new(CMD) .about("Manage wallets, from which validator keys can be derived.") + .display_order(0) .arg( Arg::new(WALLETS_DIR_FLAG) .long(WALLETS_DIR_FLAG) diff --git a/account_manager/src/wallet/recover.rs b/account_manager/src/wallet/recover.rs index 0f58d89c4e1..b9641f11521 100644 --- a/account_manager/src/wallet/recover.rs +++ b/account_manager/src/wallet/recover.rs @@ -18,7 +18,8 @@ pub fn cli_app() -> Command { "The wallet will be created with this name. It is not allowed to \ create two wallets with the same name for the same --base-dir.", ) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(PASSWORD_FLAG) @@ -31,14 +32,16 @@ pub fn cli_app() -> Command { saved at that path. To avoid confusion, if the file does not already \ exist it must include a '.pass' suffix.", ) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(MNEMONIC_FLAG) .long(MNEMONIC_FLAG) .value_name("MNEMONIC_PATH") .help("If present, the mnemonic will be read in from this file.") - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(TYPE_FLAG) @@ -50,14 +53,16 @@ pub fn cli_app() -> Command { ) .action(ArgAction::Set) .value_parser([HD_TYPE]) - .default_value(HD_TYPE), + .default_value(HD_TYPE) + .display_order(0), ) .arg( Arg::new(STDIN_INPUTS_FLAG) .action(ArgAction::SetTrue) .hide(cfg!(windows)) .long(STDIN_INPUTS_FLAG) - .help("If present, read all user inputs from stdin instead of tty."), + .help("If present, read all user inputs from stdin instead of tty.") + .display_order(0), ) } diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 118e2dd9bf7..4b6ef255d88 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -2,7 +2,9 @@ mod metrics; use beacon_node::ProductionBeaconNode; use clap::{Arg, ArgAction, ArgMatches, Command}; -use clap_utils::{flags::DISABLE_MALLOC_TUNING_FLAG, get_color_style, get_eth2_network_config}; +use clap_utils::{ + flags::DISABLE_MALLOC_TUNING_FLAG, get_color_style, get_eth2_network_config, FLAG_HEADER, +}; use directory::{parse_path_or_default, DEFAULT_BEACON_NODE_DIR, DEFAULT_VALIDATOR_DIR}; use environment::{EnvironmentBuilder, LoggerConfig}; use eth2_network_config::{Eth2NetworkConfig, DEFAULT_HARDCODED_NETWORK, HARDCODED_NET_NAMES}; @@ -91,6 +93,7 @@ fn main() { "DEPRECATED Enables environment logging giving access to sub-protocol logs such as discv5 and libp2p", ) .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .display_order(0) ) .arg( @@ -156,6 +159,7 @@ fn main() { Arg::new("logfile-compress") .long("logfile-compress") .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .help( "If present, compress old log files. This can help reduce the space needed \ to store old logs.") @@ -166,6 +170,7 @@ fn main() { Arg::new("logfile-no-restricted-perms") .long("logfile-no-restricted-perms") .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .help( "If present, log files will be generated as world-readable meaning they can be read by \ any user on the machine. Note that logs can often contain sensitive information \ @@ -190,6 +195,7 @@ fn main() { .alias("log-colour") .help("Force outputting colors when emitting logs to the terminal.") .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .global(true) .display_order(0) ) @@ -197,6 +203,7 @@ fn main() { Arg::new("disable-log-timestamp") .long("disable-log-timestamp") .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .help("If present, do not include timestamps in logging output.") .global(true) .display_order(0) @@ -273,6 +280,7 @@ fn main() { .long("immediate-shutdown") .hide(true) .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .help( "Shuts down immediately after the Beacon Node or Validator has successfully launched. \ Used for testing only, DO NOT USE IN PRODUCTION.") @@ -288,6 +296,7 @@ fn main() { specific memory allocation issues." ) .action(ArgAction::SetTrue) + .help_heading(FLAG_HEADER) .global(true) .display_order(0) ) diff --git a/scripts/cli.sh b/scripts/cli.sh index 2767ed73c80..d7386fc64b8 100755 --- a/scripts/cli.sh +++ b/scripts/cli.sh @@ -12,9 +12,6 @@ write_to_file() { local file="$2" local program="$3" - # Remove first line of cmd to get rid of commit specific numbers. - cmd=${cmd#*$'\n'} - # We need to add the header and the backticks to create the code block. printf "# %s\n\n\`\`\`\n%s\n\`\`\`" "$program" "$cmd" > "$file" diff --git a/validator_manager/src/move_validators.rs b/validator_manager/src/move_validators.rs index db94ec5c94b..b95e759e9f8 100644 --- a/validator_manager/src/move_validators.rs +++ b/validator_manager/src/move_validators.rs @@ -85,14 +85,16 @@ pub fn cli_app() -> Command { ) .required(true) .requires(SRC_VC_TOKEN_FLAG) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(SRC_VC_TOKEN_FLAG) .long(SRC_VC_TOKEN_FLAG) .value_name("PATH") .help("The file containing a token required by the source validator client.") - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(DEST_VC_URL_FLAG) @@ -105,14 +107,16 @@ pub fn cli_app() -> Command { ) .required(true) .requires(DEST_VC_TOKEN_FLAG) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(DEST_VC_TOKEN_FLAG) .long(DEST_VC_TOKEN_FLAG) .value_name("PATH") .help("The file containing a token required by the destination validator client.") - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(VALIDATORS_FLAG) @@ -122,7 +126,8 @@ pub fn cli_app() -> Command { "The validators to be moved. Either a list of 0x-prefixed \ validator pubkeys or the keyword \"all\".", ) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(COUNT_FLAG) @@ -130,7 +135,8 @@ pub fn cli_app() -> Command { .value_name("VALIDATOR_COUNT") .help("The number of validators to move.") .conflicts_with(VALIDATORS_FLAG) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(GAS_LIMIT_FLAG) @@ -141,7 +147,8 @@ pub fn cli_app() -> Command { to leave this as the default value by not specifying this flag.", ) .required(false) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(FEE_RECIPIENT_FLAG) @@ -152,7 +159,8 @@ pub fn cli_app() -> Command { fee recipient. Omit this flag to use the default value from the VC.", ) .required(false) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(BUILDER_PROPOSALS_FLAG) @@ -163,14 +171,16 @@ pub fn cli_app() -> Command { ) .required(false) .value_parser(["true", "false"]) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) .arg( Arg::new(STDIN_INPUTS_FLAG) .action(ArgAction::SetTrue) .hide(cfg!(windows)) .long(STDIN_INPUTS_FLAG) - .help("If present, read all user inputs from stdin instead of tty."), + .help("If present, read all user inputs from stdin instead of tty.") + .display_order(0), ) .arg( Arg::new(BUILDER_BOOST_FACTOR_FLAG) @@ -183,7 +193,8 @@ pub fn cli_app() -> Command { a percentage multiplier to apply to the builder's payload value \ when choosing between a builder payload header and payload from \ the local execution node.", - ), + ) + .display_order(0), ) .arg( Arg::new(PREFER_BUILDER_PROPOSALS_FLAG) @@ -194,7 +205,8 @@ pub fn cli_app() -> Command { ) .required(false) .value_parser(["true", "false"]) - .action(ArgAction::Set), + .action(ArgAction::Set) + .display_order(0), ) }