Update account manager CLI

This commit is contained in:
Paul Hauner
2019-11-18 21:30:26 +11:00
parent c1b541867e
commit 1e67663c0c
5 changed files with 218 additions and 174 deletions

View File

@@ -1,10 +1,8 @@
use clap::{App, Arg, SubCommand};
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new("Account Manager")
.visible_aliases(&["am", "accounts", "accounts_manager"])
.version("0.0.1")
.author("Sigma Prime <contact@sigmaprime.io>")
App::new("account_manager")
.visible_aliases(&["am", "account", "account_manager"])
.about("Eth 2.0 Accounts Manager")
.arg(
Arg::with_name("logfile")
@@ -22,33 +20,45 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.takes_value(true),
)
.subcommand(
SubCommand::with_name("generate")
.about("Generates a new validator private key")
.version("0.0.1")
.author("Sigma Prime <contact@sigmaprime.io>"),
)
.subcommand(
SubCommand::with_name("generate_deterministic")
.about("Generates a deterministic validator private key FOR TESTING")
SubCommand::with_name("validator")
.about("Eth2 validator managment commands.")
.version("0.0.1")
.author("Sigma Prime <contact@sigmaprime.io>")
.arg(
Arg::with_name("validator index")
.long("index")
.short("i")
.value_name("index")
.help("The index of the validator, for which the test key is generated")
.takes_value(true)
.required(true),
.subcommand(
SubCommand::with_name("new")
.about("Create a new validator.")
.subcommand(
SubCommand::with_name("insecure")
.about("Uses the insecure deterministic keypairs. Do not store value in these.")
.arg(
Arg::with_name("first")
.index(1)
.value_name("INDEX")
.help("Index of the first validator")
.takes_value(true)
.required(true),
)
.arg(
Arg::with_name("last")
.index(2)
.value_name("INDEX")
.help("Index of the first validator")
.takes_value(true)
.required(true),
),
)
.subcommand(
SubCommand::with_name("random")
.about("Uses the Rust rand crate ThreadRandom to generate keys.")
.arg(
Arg::with_name("validator_count")
.index(1)
.value_name("INTEGER")
.help("The number of new validators to generate.")
.takes_value(true)
.default_value("1"),
),
)
)
.arg(
Arg::with_name("validator count")
.long("validator_count")
.short("n")
.value_name("validator_count")
.help("If supplied along with `index`, generates keys `i..i + n`.")
.takes_value(true)
.default_value("1"),
),
)
}