Files
lighthouse/validator_manager/src/lib.rs
2022-09-22 16:45:52 +10:00

34 lines
896 B
Rust

use clap::App;
use clap::ArgMatches;
use environment::Environment;
use types::EthSpec;
mod validators;
pub const CMD: &str = "validator_manager";
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new(CMD)
.visible_aliases(&["vm", CMD])
.about("Utilities for managing a Lighthouse validator client via the HTTP API.")
.subcommand(validators::cli_app())
}
/// Run the account manager, returning an error if the operation did not succeed.
pub async fn run<'a, T: EthSpec>(
matches: &'a ArgMatches<'a>,
env: Environment<T>,
) -> Result<(), String> {
match matches.subcommand() {
(validators::CMD, Some(matches)) => validators::cli_run(matches, env).await?,
(unknown, _) => {
return Err(format!(
"{} is not a valid {} command. See --help.",
unknown, CMD
));
}
}
Ok(())
}