mithril_client_cli/commands/tools/utxo_hd/
mod.rs

1//! Commands for UTxO-HD
2mod snapshot_converter;
3
4pub use snapshot_converter::*;
5
6use anyhow::anyhow;
7use clap::Subcommand;
8
9use mithril_client::MithrilResult;
10
11use crate::CommandContext;
12
13/// UTxO-HD related commands
14#[derive(Subcommand, Debug, Clone)]
15pub enum UTxOHDCommands {
16    /// Convert a restored `InMemory` ledger snapshot to another flavor.
17    #[clap(arg_required_else_help = false)]
18    SnapshotConverter(SnapshotConverterCommand),
19}
20
21impl UTxOHDCommands {
22    /// Execute UTxO-HD command
23    pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
24        match self {
25            Self::SnapshotConverter(cmd) => {
26                if cfg!(target_os = "linux") && cfg!(target_arch = "aarch64") {
27                    return Err(anyhow!(
28                        "'snapshot-converter' command is not supported on Linux ARM"
29                    ));
30                }
31                cmd.execute(context).await
32            }
33        }
34    }
35}