8e20176337
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>
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
mod common;
|
|
pub mod validator;
|
|
pub mod wallet;
|
|
|
|
use clap::App;
|
|
use clap::ArgMatches;
|
|
use environment::Environment;
|
|
use types::EthSpec;
|
|
|
|
pub const CMD: &str = "account_manager";
|
|
pub const SECRETS_DIR_FLAG: &str = "secrets-dir";
|
|
pub const VALIDATOR_DIR_FLAG: &str = "validator-dir";
|
|
pub const WALLETS_DIR_FLAG: &str = "wallets-dir";
|
|
|
|
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|
App::new(CMD)
|
|
.visible_aliases(&["a", "am", "account", CMD])
|
|
.about("Utilities for generating and managing Ethereum 2.0 accounts.")
|
|
.subcommand(wallet::cli_app())
|
|
.subcommand(validator::cli_app())
|
|
}
|
|
|
|
/// Run the account manager, returning an error if the operation did not succeed.
|
|
pub fn run<T: EthSpec>(matches: &ArgMatches<'_>, env: Environment<T>) -> Result<(), String> {
|
|
match matches.subcommand() {
|
|
(wallet::CMD, Some(matches)) => wallet::cli_run(matches)?,
|
|
(validator::CMD, Some(matches)) => validator::cli_run(matches, env)?,
|
|
(unknown, _) => {
|
|
return Err(format!(
|
|
"{} is not a valid {} command. See --help.",
|
|
unknown, CMD
|
|
));
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|