Change account_manager CLI options

This commit is contained in:
Paul Hauner 2019-05-29 14:06:38 +10:00
parent f89cb65360
commit 7c2ca85e34
No known key found for this signature in database
GPG Key ID: 5E2CFF9B75FA63DF

View File

@ -45,12 +45,13 @@ fn main() {
.required(true), .required(true),
) )
.arg( .arg(
Arg::with_name("end validator index") Arg::with_name("validator count")
.long("end_index") .long("validator_count")
.short("j") .short("n")
.value_name("end_index") .value_name("validator_count")
.help("If supplied along with `index`, generates a range of keys.") .help("If supplied along with `index`, generates keys `i..i + n`.")
.takes_value(true), .takes_value(true)
.default_value("1"),
), ),
) )
.get_matches(); .get_matches();
@ -67,10 +68,10 @@ fn main() {
("generate_deterministic", Some(m)) => { ("generate_deterministic", Some(m)) => {
if let Some(string) = m.value_of("validator index") { if let Some(string) = m.value_of("validator index") {
let i: usize = string.parse().expect("Invalid validator index"); let i: usize = string.parse().expect("Invalid validator index");
if let Some(string) = m.value_of("end validator index") { if let Some(string) = m.value_of("validator count") {
let j: usize = string.parse().expect("Invalid end validator index"); let n: usize = string.parse().expect("Invalid end validator count");
let indices: Vec<usize> = (i..j).collect(); let indices: Vec<usize> = (i..i + n).collect();
generate_deterministic_multiple(&indices, &config, &log) generate_deterministic_multiple(&indices, &config, &log)
} else { } else {
generate_deterministic(i, &config, &log) generate_deterministic(i, &config, &log)