mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Closes #1487 Closes #1427 Directory restructure in accordance with #1487. Also has temporary migration code to move the old directories into new structure. Also extracts all default directory names and utility functions into a `directory` crate to avoid repetitio. ~Since `validator_definition.yaml` stores absolute paths, users will have to manually change the keystore paths or delete the file to get the validators picked up by the vc.~. `validator_definition.yaml` is migrated as well from the default directories. Co-authored-by: realbigsean <seananderson33@gmail.com> Co-authored-by: Paul Hauner <paul@paulhauner.com>
25 lines
638 B
Rust
25 lines
638 B
Rust
use crate::VALIDATOR_DIR_FLAG;
|
|
use clap::App;
|
|
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.")
|
|
}
|
|
|
|
pub fn cli_run(validator_dir: PathBuf) -> Result<(), String> {
|
|
let mgr = ValidatorManager::open(&validator_dir)
|
|
.map_err(|e| format!("Unable to read --{}: {:?}", VALIDATOR_DIR_FLAG, e))?;
|
|
|
|
for (name, _path) in mgr
|
|
.directory_names()
|
|
.map_err(|e| format!("Unable to list validators: {:?}", e))?
|
|
{
|
|
println!("{}", name)
|
|
}
|
|
|
|
Ok(())
|
|
}
|