mithril_client_cli/commands/tools/
mod.rs

1//! Tools commands
2//!
3//! Provides utility subcommands such as converting restored InMemory UTxO-HD ledger snapshot
4//! to different flavors (Legacy, LMDB).
5
6mod aggregator_discovery;
7mod utxo_hd;
8
9pub use aggregator_discovery::*;
10pub use utxo_hd::*;
11
12use clap::Subcommand;
13
14use mithril_client::MithrilResult;
15
16use crate::CommandContext;
17
18/// Tools commands
19#[derive(Subcommand, Debug, Clone)]
20#[command(about = "Tools commands")]
21pub enum ToolsCommands {
22    /// UTxO-HD related commands
23    #[clap(subcommand, name = "utxo-hd")]
24    UTxOHD(UTxOHDCommands),
25    /// Aggregator discovery command (unstable)
26    #[clap(name = "discover-aggregator")]
27    AggregatorDiscovery(AggregatorDiscoveryCommand),
28}
29
30impl ToolsCommands {
31    /// Execute Tools command
32    pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
33        match self {
34            Self::UTxOHD(cmd) => cmd.execute(context).await,
35            Self::AggregatorDiscovery(cmd) => {
36                context.require_unstable("tools discover-aggregator", Some("release-mainnet"))?;
37
38                cmd.execute(context).await
39            }
40        }
41    }
42}