guardy 0.2.4

Fast, secure git hooks in Rust with secret scanning and protected file synchronization
Documentation
use anyhow::Result;
use clap::Args;

#[derive(Args, Clone)]
pub struct VersionArgs {
    /// Show detailed version information
    #[arg(short = 'd', long = "detailed")]
    pub detailed: bool,

    /// Show comprehensive build information including target architecture
    #[arg(short = 'b', long = "build-info")]
    pub build_info: bool,
}

pub async fn execute(args: VersionArgs) -> Result<()> {
    use crate::cli::banner;

    // Get the git branch from build time
    let git_branch = option_env!("GIT_BRANCH").unwrap_or("unknown");

    // Print banner without context (version and SHA are already in the banner)
    banner::print_banner(None);

    if args.build_info {
        // Show comprehensive build information
        println!("\n📦 Build Information:");
        println!("   Version:     {}", env!("CARGO_PKG_VERSION"));
        println!("   Commit:      {}", env!("GIT_SHA"));
        println!("   Branch:      {}", git_branch);
        println!("   Target:      {}", env!("TARGET"));
        println!("   Profile:     {}", env!("PROFILE"));
        println!("   Rustc:       {}", env!("RUSTC_VERSION"));
        println!("   Built:       {}", env!("BUILD_TIMESTAMP"));
        println!();
        println!("📋 Package Details:");
        println!("   Name:        {}", env!("CARGO_PKG_NAME"));
        println!("   Repository:  {}", env!("CARGO_PKG_REPOSITORY"));
        println!("   License:     {}", env!("CARGO_PKG_LICENSE"));
        println!("   Description: {}", env!("CARGO_PKG_DESCRIPTION"));
    } else if args.detailed {
        println!("\nBranch: {git_branch}");
        println!("Rust Edition: 2024");
        println!("Built with: clap 4.5.41, tokio 1.46.1, dialoguer 0.11.0");
        println!("Repository: {}", env!("CARGO_PKG_REPOSITORY"));
        println!("License: {}", env!("CARGO_PKG_LICENSE"));
        println!("Description: {}", env!("CARGO_PKG_DESCRIPTION"));
    }
    Ok(())
}