diff --git a/src/main.rs b/src/main.rs index e0f0e6ca0bf4dd80815ff6206ba6f49a680986a3..e92f352c30f43cdde0da0fb5418cfcee6be57aae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use clap::{Args, Parser, Subcommand}; mod checkout; mod commit; +mod create_hooks; mod init; mod list; @@ -31,6 +32,15 @@ enum Commands { /// Checkout results to the current git commit #[clap(alias = "co")] Checkout(Checkout), + /// Create github hooks to use gbl automaticaly after commit, before and afetr checkout + /// + /// This command should be used after git init and glb init. + /// This will create 3 hooks file: + /// 1. post-commit: `glb commit` will be launched after git commit + /// 2. pre-checkout: `glb pre-co` will be launched before git checkout + /// 3. post-checkout: `gbl checkout` will be launched after git checkout + #[clap(name = "create-hooks", alias = "ch")] + CreateHooks(CreateHooks), } #[derive(Debug, Args)] @@ -67,6 +77,13 @@ struct Checkout { mode: String, } +#[derive(Debug, Args)] +struct CreateHooks { + /// The compression that will automatically be used after each commit + #[clap(short, long, default_value = "lz4")] + compression: String, +} + fn main() { let args = Cli::parse(); @@ -86,5 +103,8 @@ fn main() { Commands::Checkout(co) => { checkout::checkout(&co.mode); } + Commands::CreateHooks(ch) => { + create_hooks::create_hooks(&ch.compression); + } } }