Improve account manager CLI (#1404)

## Proposed Changes

Fixes some sharp edges on the new `lighthouse account validator list` command, and the account manager CLI.

* Validator names/keys are always printed in the same order due to the use of a sorted `BTreeMap`
* The `validator list` subcommand now respects the `--validator-dir` flag, instead of always looking in `~/.lighthouse/validators`
* The `--help` now shows a description for the `wallet` subcommand instead of just `TODO`
This commit is contained in:
Michael Sproul
2020-07-29 04:32:52 +00:00
parent eaa9f9744f
commit f53dedb27d
4 changed files with 21 additions and 10 deletions

View File

@@ -50,7 +50,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.long(VALIDATOR_DIR_FLAG)
.value_name("VALIDATOR_DIRECTORY")
.help(
"The path the validator client data directory. \
"The path to the validator client data directory. \
Defaults to ~/.lighthouse/validators",
)
.takes_value(true),

View File

@@ -1,12 +1,23 @@
use crate::VALIDATOR_DIR_FLAG;
use clap::{App, ArgMatches};
use clap::{App, Arg, ArgMatches};
use std::path::PathBuf;
use validator_dir::Manager as ValidatorManager;
pub const CMD: &str = "list";
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new(CMD).about("Lists the names of all validators.")
App::new(CMD)
.arg(
Arg::with_name(VALIDATOR_DIR_FLAG)
.long(VALIDATOR_DIR_FLAG)
.value_name("VALIDATOR_DIRECTORY")
.help(
"The path to search for validator directories. \
Defaults to ~/.lighthouse/validators",
)
.takes_value(true),
)
.about("Lists the names of all validators.")
}
pub fn cli_run(matches: &ArgMatches<'_>) -> Result<(), String> {

View File

@@ -11,7 +11,7 @@ pub const CMD: &str = "wallet";
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new(CMD)
.about("TODO")
.about("Manage wallets, from which validator keys can be derived.")
.arg(
Arg::with_name(BASE_DIR_FLAG)
.long(BASE_DIR_FLAG)