cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
//! `cartu issue metrics` — parent for the flow-metrics surface
//! (`summary`, `distribution`, `forecast`).

use clap::{ArgMatches, Command};

use super::{distribution, stats};
use crate::infra::driving::cli::Context;

pub(super) fn subcommand() -> Command {
    Command::new("metrics")
        .about("Flow metrics: throughput, distribution, and forecast")
        .subcommand_required(true)
        .arg_required_else_help(true)
        .subcommand(stats::summary_subcommand())
        .subcommand(distribution::subcommand())
        .subcommand(stats::forecast_subcommand())
}

pub(super) fn execute(matches: &ArgMatches, ctx: &Context<'_>) {
    match matches.subcommand() {
        Some(("summary", sub)) => stats::execute_summary(sub, ctx),
        Some(("distribution", sub)) => distribution::execute(sub, ctx),
        Some(("forecast", sub)) => stats::execute_forecast(sub, ctx),
        _ => unreachable!(),
    }
}