mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Fix naming of validators in CLI (#1332)
## Issue Addressed NA ## Proposed Changes - Adds a `lighthouse account validator list` command, to list all known validators. - Fixes the validator names; previously they were using a full path (e.g., `"/home/paul/.lighthouse/validators/0x8ce25415d078bdc83133758604578ba51707a55965eeca8982f44695db7432d6ff1c23529020a971faa68ab60baf3118"` but now we only use the final directory name (e.g., `0x8ce25415d078bdc83133758604578ba51707a55965eeca8982f44695db7432d6ff1c23529020a971faa68ab60baf3118`).
This commit is contained in:
@@ -164,10 +164,12 @@ impl Manager {
|
||||
///
|
||||
/// 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()
|
||||
.map(|path| (format!("{:?}", path), path)),
|
||||
))
|
||||
Ok(HashMap::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