grov 0.5.0

An opinionated bare-repo-only git worktree manager
Documentation
pub mod cli;
pub mod commands;
pub mod config;
pub mod errors;
pub mod git;
pub mod paths;
pub mod ui;

use anyhow::Context;
use clap::Parser;

use cli::{Cli, Commands};

pub fn run() -> anyhow::Result<()> {
    let cli = Cli::parse();

    match cli.command {
        Commands::Init {
            url,
            name,
            prefix,
            branch,
            path,
        } => {
            commands::init::execute(
                url.as_deref(),
                name.as_deref(),
                prefix.as_deref(),
                branch.as_deref(),
                path.as_deref(),
            )
            .context("init failed")?;
        }
        Commands::Add { branch, base, path } => {
            commands::add::execute(&branch, base.as_deref(), path.as_deref())
                .context("add failed")?;
        }
        Commands::List { compact } => {
            commands::list::execute(compact).context("list failed")?;
        }
        Commands::Remove {
            name,
            match_mode,
            delete_branch,
            force,
        } => {
            commands::remove::execute(&name, match_mode, delete_branch, force)
                .context("remove failed")?;
        }
        Commands::Completions { shell } => {
            commands::completions::execute(shell);
        }
    }

    Ok(())
}