hermes_cli/commands/keys/
mod.rs

1mod add;
2pub use add::KeysAddCmd;
3
4mod list;
5pub use list::KeysListCmd;
6
7mod delete;
8pub use delete::KeysDeleteCmd;
9
10mod balance;
11pub use balance::KeysBalanceCmd;
12use hermes_cli_framework::command::CommandRunner;
13use hermes_cli_framework::output::Output;
14
15use crate::contexts::app::HermesApp;
16use crate::Result;
17
18/// `keys` subcommand
19#[derive(Debug, clap::Parser)]
20pub enum KeysCmd {
21    /// Add a key to a chain from its keyring file or restore a key using its mnemonic
22    Add(KeysAddCmd),
23
24    /// List the private key file that was added to a chain
25    List(KeysListCmd),
26
27    /// Delete key(s) from a configured chain
28    Delete(KeysDeleteCmd),
29
30    /// Retrieve the balance for a key from a configured chain
31    Balance(KeysBalanceCmd),
32}
33
34impl CommandRunner<HermesApp> for KeysCmd {
35    async fn run(&self, app: &HermesApp) -> Result<Output> {
36        match self {
37            Self::Add(cmd) => cmd.run(app).await,
38            Self::List(cmd) => cmd.run(app).await,
39            Self::Delete(cmd) => cmd.run(app).await,
40            Self::Balance(cmd) => cmd.run(app).await,
41        }
42    }
43}