clubs-cli 0.1.0

Command-line interface for composing and inspecting Gordian Club editions.
pub mod compose;
pub mod permits;
pub mod sequence;
pub mod verify;

use anyhow::Result;
use clap::{Args, Subcommand};

#[derive(Debug, Args)]
pub struct CommandArgs {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
    /// Compose and sign an edition.
    Compose(compose::CommandArgs),
    /// Verify the signature and provenance of an edition.
    Verify(verify::CommandArgs),
    /// Extract sealed permits from an edition.
    Permits(permits::CommandArgs),
    /// Validate a sequence of editions for provenance continuity.
    Sequence(sequence::CommandArgs),
}

pub fn exec(args: CommandArgs) -> Result<()> {
    match args.command {
        Commands::Compose(args) => compose::exec(args),
        Commands::Verify(args) => verify::exec(args),
        Commands::Permits(args) => permits::exec(args),
        Commands::Sequence(args) => sequence::exec(args),
    }
}