vampus 0.4.5

A CLI tool for automated semantic version management across configurable file patterns.
use clap::{ArgAction, Args, Parser, Subcommand};

const DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
const VERSION: &str = env!("CARGO_PKG_VERSION");
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");

#[derive(Parser)]
#[command(author = AUTHORS, version = VERSION, about, long_about = DESCRIPTION)]
pub struct Cli {
    #[arg(short, long, action = ArgAction::SetTrue)]
    /// Enables debug messages for the 'vampus' application.
    pub debug: bool,

    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Generate shell completion scripts.
    Completions(ShellArgs),

    /// Increments the project version (updates the version number in the configuration).
    Upgrade(VersionArgs),

    /// Shows the resulting project version without applying the change.
    Preview(VersionArgs),

    /// Sets the project version back to a calculated previous version and updates the files.
    Downgrade(VersionArgs),

    /// Displays the current version of the project.
    Show,

    /// Creates a default .vampus.yml configuration file in the current directory.
    Init,
}

#[derive(Args)]
/// Arguments specific to version manipulation commands (upgrade, downgrade, preview).
pub struct VersionArgs {
    /// Increments/Decrements the PATCH version (bug fixes).
    #[arg(long, action = ArgAction::SetTrue, group = "VERSION_TYPE")]
    pub patch: bool,

    /// Increments/Decrements the MINOR version (new features).
    #[arg(long, action = ArgAction::SetTrue, group = "VERSION_TYPE")]
    pub minor: bool,

    /// Increments/Decrements the MAJOR version (breaking changes).
    #[arg(long, action = ArgAction::SetTrue, group = "VERSION_TYPE")]
    pub major: bool,
}

#[derive(Args)]
pub struct ShellArgs {
    /// The shell to generate completions for.
    #[arg(value_enum)]
    pub shell: clap_complete::Shell,
}