gitkit 0.4.0

Standalone CLI for configuring git repos — hooks, .gitignore, and .gitattributes
use anyhow::Result;
use clap::{Parser, Subcommand};

mod attributes;
mod builds;
mod clone;
mod config;
mod git;
mod hooks;
mod ignore;
mod init;
mod status;
mod utils;

#[derive(Parser)]
#[command(
    name = "gitkit",
    version,
    about = "Standalone CLI for configuring git repos"
)]
struct Cli {
    #[command(subcommand)]
    command: Option<Command>,
}

#[derive(Subcommand)]
enum Command {
    /// Interactive wizard to configure your repo
    Init,
    /// Show current configuration status
    Status,
    /// Clone repository and run init wizard
    Clone(clone::CloneArgs),
    /// Manage git hooks
    Hooks {
        #[command(subcommand)]
        action: hooks::HooksCommand,
    },
    /// Generate .gitignore via gitignore.io
    Ignore {
        #[command(subcommand)]
        action: ignore::IgnoreCommand,
    },
    /// Configure .gitattributes
    Attributes {
        #[command(subcommand)]
        action: attributes::AttributesCommand,
    },
    /// Apply curated git config presets
    Config {
        #[command(subcommand)]
        action: config::ConfigCommand,
    },
    /// Manage saved builds
    Build {
        #[command(subcommand)]
        action: builds::BuildCommand,
    },
}

fn main() -> Result<()> {
    let cli = Cli::parse();
    match cli.command {
        Some(Command::Init) | None => init::run(),
        Some(Command::Status) => status::run(),
        Some(Command::Clone(args)) => clone::run(args),
        Some(Command::Hooks { action }) => hooks::run(action),
        Some(Command::Ignore { action }) => ignore::run(action),
        Some(Command::Attributes { action }) => attributes::run(action),
        Some(Command::Config { action }) => config::run(action),
        Some(Command::Build { action }) => builds::run(action),
    }
}