Skip to content

Commit

Permalink
upgrade clap to v4.5 (#5273)
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 9a39467
Author: Eitan Seri-Levi <[email protected]>
Date:   Mon May 20 07:24:00 2024 +0100

    cli

commit aa4334f
Merge: 8180839 b5de925
Author: Eitan Seri-Levi <[email protected]>
Date:   Mon May 20 06:57:20 2024 +0100

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli

commit 8180839
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue May 14 12:24:53 2024 +0300

    retry cli check

commit 3c26b9a
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue May 14 12:24:39 2024 +0300

    retry cli check

commit 61da93f
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue May 14 12:10:10 2024 +0300

    cli check

commit f8a8536
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue May 14 12:09:54 2024 +0300

    cli check

commit 0be7b71
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue May 14 11:50:10 2024 +0300

    md changes

commit c5a3058
Author: Eitan Seri-Levi <[email protected]>
Date:   Sun May 12 15:18:48 2024 +0300

    book changes

commit 82d1bc3
Merge: be90ac7 6d792b4
Author: Eitan Seri-Levi <[email protected]>
Date:   Sun May 12 15:04:52 2024 +0300

    resolve merge conflicts

commit be90ac7
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 30 17:35:55 2024 +0300

    fix eth sim cli

commit b8bea91
Author: Eitan Seri-Levi <[email protected]>
Date:   Sat Apr 27 15:37:41 2024 +0300

    require at least one arg

commit 6a81d12
Author: Eitan Seri-Levi <[email protected]>
Date:   Sat Apr 27 15:26:49 2024 +0300

    revert simulator changes

commit c6b9712
Merge: de33110 13f94ef
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 26 11:00:48 2024 +0300

    merge conflicts

commit de33110
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 26 10:57:07 2024 +0300

    resolve merge conflicts

commit ac451a8
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 25 23:43:24 2024 +0300

    revert

commit f5f114f
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 25 23:41:29 2024 +0300

    revert

commit fa7c4b3
Merge: bd4e5c9 3203456
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 25 23:40:42 2024 +0300

    merge

commit bd4e5c9
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 16 01:22:14 2024 +0300

    fmt

commit 7f4af13
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 16 01:06:16 2024 +0300

    help text, text width, and a few flag fixes

commit e23b96b
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 12 10:52:28 2024 +0300

    md

commit 0a624c9
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 12 10:35:46 2024 +0300

    merge conflicts

commit d19c9e7
Merge: 75c2c72 6bac5ce
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 12 10:23:55 2024 +0300

    merge conflict

commit 75c2c72
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 12 10:20:02 2024 +0300

    md files

commit 568bf79
Author: realbigsean <[email protected]>
Date:   Wed Apr 10 17:28:27 2024 -0400

    cli help updates

commit ebdc22b
Merge: a4c4bb5 54fbdda
Author: realbigsean <[email protected]>
Date:   Wed Apr 10 17:21:44 2024 -0400

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli

commit a4c4bb5
Author: realbigsean <[email protected]>
Date:   Wed Apr 10 15:54:49 2024 -0400

    cli help updates

commit 51c4419
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 9 23:17:54 2024 +0300

    update

commit 9de4980
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 9 23:16:22 2024 +0300

    remove -e files

commit 71ff732
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Apr 9 23:14:47 2024 +0300

    update

commit e4a4b88
Author: Eitan Seri-Levi <[email protected]>
Date:   Mon Apr 8 08:36:31 2024 +0300

    make cli

commit 8911e3c
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 5 08:57:49 2024 +0300

    make cli

commit daec018
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 5 08:49:00 2024 +0300

    fix broken flag

commit 35bdf5e
Author: Eitan Seri-Levi <[email protected]>
Date:   Fri Apr 5 00:06:02 2024 +0300

    fmt got me again

commit 4555fb2
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 23:55:55 2024 +0300

    revert removed if statement

commit 71edfe8
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 23:41:03 2024 +0300

    fix test

commit 0dd6423
Merge: 30556d0 b65daac
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 23:10:52 2024 +0300

    resolve conflicts

commit 30556d0
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 23:05:22 2024 +0300

    fix test

commit f6653b0
Merge: 0c92aaa feb531f
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 21:49:31 2024 +0300

    resolve merge conflict

commit 0c92aaa
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 21:48:22 2024 +0300

    alphabetic order

commit e320c99
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 21:06:39 2024 +0300

    update

commit 9b40a14
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 00:56:37 2024 +0300

    fmt

commit fb3b8dd
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Apr 4 00:52:05 2024 +0300

    remove unneeded check

commit 7b50109
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Apr 3 23:23:59 2024 +0300

    add custom flag parser, make rate limiter flags clap friendly

commit 7b558bd
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Apr 3 15:02:58 2024 +0300

    add num args, version

commit d00855e
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Apr 3 02:12:02 2024 +0300

    resolve beta compiler issue

commit 88f083a
Merge: f4447b7 969d12d
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Apr 3 01:50:11 2024 +0300

    merge conflicts

commit f4447b7
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Mar 13 15:42:14 2024 +0200

    fix eth sim

commit 1f45d1f
Author: Eitan Seri-Levi <[email protected]>
Date:   Wed Mar 13 15:24:33 2024 +0200

    fix eth sim

commit acc8c6d
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Mar 12 20:02:12 2024 +0200

    default --format val

commit c3d6ede
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Mar 12 17:31:58 2024 +0200

    merge unstable

commit b34b11d
Merge: e05b856 2a3c709
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Mar 12 17:12:10 2024 +0200

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli

commit e05b856
Author: Eitan Seri-Levi <[email protected]>
Date:   Sat Feb 24 09:33:28 2024 +0200

    value parser for mnemonic

commit 4743a2c
Merge: 1de4880 b5bae6e
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Feb 22 09:14:23 2024 +0200

    Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli

commit 1de4880
Author: Eitan Seri-Levi <[email protected]>
Date:   Thu Feb 22 09:14:20 2024 +0200

    cli fixes

commit 3b8fd4a
Author: Eitan Seri-Levi <[email protected]>
Date:   Tue Feb 20 23:46:40 2024 +0200

    upgrade clap to v4.5
  • Loading branch information
michaelsproul committed May 24, 2024
1 parent 14679ab commit 001b612
Show file tree
Hide file tree
Showing 61 changed files with 4,038 additions and 2,870 deletions.
136 changes: 111 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ bincode = "1"
bitvec = "1"
byteorder = "1"
bytes = "1"
clap = { version = "4.5.4", features = ["cargo", "wrap_help"] }
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
# feature ourselves when desired.
c-kzg = { version = "1", default-features = false }
clap = "2"
c-kzg = { version = "1", default-features = false }
compare_fields_derive = { path = "common/compare_fields_derive" }
criterion = "0.3"
delay_map = "0.3"
Expand Down
30 changes: 22 additions & 8 deletions account_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ mod common;
pub mod validator;
pub mod wallet;

use clap::App;
use clap::Arg;
use clap::ArgAction;
use clap::ArgMatches;
use clap::Command;
use clap_utils::FLAG_HEADER;
use environment::Environment;
use types::EthSpec;

Expand All @@ -13,25 +16,36 @@ pub const VALIDATOR_DIR_FLAG: &str = "validator-dir";
pub const VALIDATOR_DIR_FLAG_ALIAS: &str = "validators-dir";
pub const WALLETS_DIR_FLAG: &str = "wallets-dir";

pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new(CMD)
.visible_aliases(&["a", "am", "account", CMD])
pub fn cli_app() -> Command {
Command::new(CMD)
.visible_aliases(["a", "am", "account", CMD])
.about("Utilities for generating and managing Ethereum 2.0 accounts.")
.display_order(0)
.arg(
Arg::new("help")
.long("help")
.short('h')
.help("Prints help information")
.action(ArgAction::HelpLong)
.display_order(0)
.help_heading(FLAG_HEADER),
)
.subcommand(wallet::cli_app())
.subcommand(validator::cli_app())
}

/// Run the account manager, returning an error if the operation did not succeed.
pub fn run<E: EthSpec>(matches: &ArgMatches<'_>, env: Environment<E>) -> Result<(), String> {
pub fn run<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> Result<(), String> {
match matches.subcommand() {
(wallet::CMD, Some(matches)) => wallet::cli_run(matches)?,
(validator::CMD, Some(matches)) => validator::cli_run(matches, env)?,
(unknown, _) => {
Some((wallet::CMD, matches)) => wallet::cli_run(matches)?,
Some((validator::CMD, matches)) => validator::cli_run(matches, env)?,
Some((unknown, _)) => {
return Err(format!(
"{} is not a valid {} command. See --help.",
unknown, CMD
));
}
_ => return Err("No subcommand provided, see --help for options".to_string()),
}

Ok(())
Expand Down
Loading

0 comments on commit 001b612

Please sign in to comment.