1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//! Commands for the Cardano Stake Distribution artifact
mod download;
mod list;

pub use download::*;
pub use list::*;

use crate::CommandContext;
use clap::Subcommand;
use mithril_client::MithrilResult;

/// Cardano Stake Distribution management (alias: csd)
#[derive(Subcommand, Debug, Clone)]
#[command(about = "Cardano stake distribution management (alias: csd)")]
pub enum CardanoStakeDistributionCommands {
    /// List certified Cardano Stake Distributions
    #[clap(arg_required_else_help = false)]
    List(CardanoStakeDistributionListCommand),

    /// Download and verify the given Cardano Stake Distribution
    #[clap(arg_required_else_help = true)]
    Download(CardanoStakeDistributionDownloadCommand),
}

impl CardanoStakeDistributionCommands {
    /// Execute Cardano Stake Distribution command
    pub async fn execute(&self, config_builder: CommandContext) -> MithrilResult<()> {
        match self {
            Self::List(cmd) => cmd.execute(config_builder).await,
            Self::Download(cmd) => cmd.execute(config_builder).await,
        }
    }
}