hermes_cli/commands/
mod.rs

1use hermes_cli_components::impls::commands::start::StartRelayerArgs;
2use hermes_cli_components::traits::command::CanRunCommand;
3use hermes_cli_framework::command::CommandRunner;
4use hermes_cli_framework::output::Output;
5
6use crate::contexts::app::HermesApp;
7use crate::Result;
8
9pub mod bootstrap;
10pub mod channel;
11pub mod clear;
12pub mod client;
13pub mod connection;
14pub mod query;
15
16pub mod keys;
17
18#[derive(Debug, clap::Parser)]
19pub enum HermesCommand {
20    /// Start the Hermes relayer
21    Start(StartRelayerArgs),
22
23    /// Work with clients
24    #[clap(subcommand)]
25    Client(client::ClientCommands),
26
27    /// Work with connections
28    #[clap(subcommand)]
29    Connection(connection::ConnectionCommands),
30
31    /// Work with channels
32    #[clap(subcommand)]
33    Channel(channel::ChannelCommands),
34
35    /// Query information about IBC objects
36    #[clap(subcommand)]
37    Query(query::QueryCommands),
38
39    /// Clear subcommands
40    #[clap(subcommand)]
41    Clear(clear::ClearCommands),
42
43    /// Manage keys in the relayer for each chain
44    #[clap(subcommand)]
45    Keys(keys::KeysCmd),
46
47    #[clap(subcommand)]
48    Bootstrap(bootstrap::subcommand::BootstrapSubCommand),
49}
50
51impl CommandRunner<HermesApp> for HermesCommand {
52    async fn run(&self, app: &HermesApp) -> Result<Output> {
53        match self {
54            Self::Start(cmd) => app.run_command(cmd).await,
55            Self::Client(cmd) => cmd.run(app).await,
56            Self::Connection(cmd) => cmd.run(app).await,
57            Self::Channel(cmd) => cmd.run(app).await,
58            Self::Query(cmd) => cmd.run(app).await,
59            Self::Clear(cmd) => cmd.run(app).await,
60            Self::Keys(cmd) => cmd.run(app).await,
61            Self::Bootstrap(cmd) => app.run_command(cmd).await,
62        }
63    }
64}