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 snapshot_converter;
7
8pub use snapshot_converter::*;
9
10use clap::Subcommand;
11use mithril_client::MithrilResult;
12
13/// Tools commands
14#[derive(Subcommand, Debug, Clone)]
15#[command(about = "[unstable] Tools commands")]
16pub enum ToolsCommands {
17    /// UTxO-HD related commands
18    #[clap(subcommand, name = "utxo-hd")]
19    UTxOHD(UTxOHDCommands),
20}
21
22impl ToolsCommands {
23    /// Execute Tools command
24    pub async fn execute(&self) -> MithrilResult<()> {
25        match self {
26            Self::UTxOHD(cmd) => cmd.execute().await,
27        }
28    }
29}
30
31/// UTxO-HD related commands
32#[derive(Subcommand, Debug, Clone)]
33pub enum UTxOHDCommands {
34    /// Convert a restored `InMemory` ledger snapshot to another flavor.
35    #[clap(arg_required_else_help = false)]
36    SnapshotConverter(SnapshotConverterCommand),
37}
38
39impl UTxOHDCommands {
40    /// Execute UTxO-HD command
41    pub async fn execute(&self) -> MithrilResult<()> {
42        match self {
43            Self::SnapshotConverter(cmd) => cmd.execute().await,
44        }
45    }
46}