mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
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:
@@ -2,7 +2,7 @@ use crate::{Error as ValidatorDirError, ValidatorDir};
|
||||
use bls::Keypair;
|
||||
use rayon::prelude::*;
|
||||
use slog::{info, warn, Logger};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::read_dir;
|
||||
use std::io;
|
||||
use std::iter::FromIterator;
|
||||
@@ -163,13 +163,13 @@ impl Manager {
|
||||
/// ## Errors
|
||||
///
|
||||
/// Returns an error if a directory is unable to be read.
|
||||
pub fn directory_names(&self) -> Result<HashMap<String, PathBuf>, Error> {
|
||||
Ok(HashMap::from_iter(self.iter_dir()?.into_iter().filter_map(
|
||||
|path| {
|
||||
pub fn directory_names(&self) -> Result<BTreeMap<String, PathBuf>, Error> {
|
||||
Ok(BTreeMap::from_iter(
|
||||
self.iter_dir()?.into_iter().filter_map(|path| {
|
||||
path.file_name()
|
||||
.and_then(|os_string| os_string.to_str().map(|s| s.to_string()))
|
||||
.map(|filename| (filename, path))
|
||||
},
|
||||
)))
|
||||
}),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user