Skip to main content

gitprofiles/
lib.rs

1pub mod cli;
2pub mod commands;
3pub mod git;
4pub mod hooks;
5pub mod models;
6pub mod paths;
7pub mod profile_store;
8pub mod repo_profile;
9pub mod validate;
10
11use clap::Parser;
12
13use crate::cli::{Cli, Command};
14
15pub fn run() -> anyhow::Result<()> {
16    let cli = Cli::parse();
17    if let Err(err) = hooks::auto_repair_managed_hooks_on_startup() {
18        eprintln!("warning: failed to auto-repair managed hooks: {err}");
19    }
20
21    match cli.command {
22        Command::Init => commands::init::run(),
23        Command::Create => commands::create::run(),
24        Command::SetProfile { name } => commands::set_profile::run(name),
25        Command::Check => commands::check::run(),
26        Command::List => commands::list::run(),
27        Command::Remove { name } => commands::remove::run(name),
28    }
29}