Skip to content
Snippets Groups Projects
Commit 0af5d911 authored by nfontrod's avatar nfontrod
Browse files

src/main.rs: add create-hooks subcommand

parent eefdd243
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment