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 {
Init,
Status,
Clone(clone::CloneArgs),
Hooks {
#[command(subcommand)]
action: hooks::HooksCommand,
},
Ignore {
#[command(subcommand)]
action: ignore::IgnoreCommand,
},
Attributes {
#[command(subcommand)]
action: attributes::AttributesCommand,
},
Config {
#[command(subcommand)]
action: config::ConfigCommand,
},
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),
}
}