mfgames-conventional-commit-rs/src/commands/mod.rs

31 lines
637 B
Rust

use anyhow::Result;
use clap::{Parser, Subcommand};
mod get;
#[derive(Debug, Parser)]
#[clap(
name = "mfgames-conventional-commit",
about = "CLI for working with conventional commits"
)]
pub struct RootCommand {
#[command(subcommand)]
command: RootSubcommands,
}
#[derive(Debug, Subcommand)]
pub enum RootSubcommands {
/// Calculates the version based on the current commits.
Get(get::GetCommand),
}
impl RootCommand {
pub async fn run(&self, log: slog::Logger) -> Result<()> {
match &self.command {
RootSubcommands::Get(cmd) => cmd.run(log).await?,
};
Ok(())
}
}