From fcbedc67e831d487a2656640bfecb2501b2efc19 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Thu, 12 May 2022 15:09:31 +0200 Subject: [PATCH] src/main.rs: add mode parameter in init --- src/main.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2e512f7..0289246 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,6 +56,14 @@ struct Init { /// The compression to use automatically at each commit if hooks are created #[clap(short, long, default_value = "lz4")] compression: String, + /// The checkout mode used by gblk automatically after a git checkout: soft or hard. + + /// The hard mode will delete every file in your results folder and extract + /// those corresponding to the commit targeted by the checkout. + /// + /// The soft mode will only update files that existed in the targeted checkout + #[clap(short, long, default_value = "hard")] + mode: String, } #[derive(Debug, Args)] @@ -97,6 +105,14 @@ struct CreateHooks { /// The compression that will automatically be used after each commit #[clap(short, long, default_value = "lz4")] compression: String, + /// The checkout mode used by gblk automatically after a git checkout: soft or hard. + + /// The hard mode will delete every file in your results folder and extract + /// those corresponding to the commit targeted by the checkout. + /// + /// The soft mode will only update files that existed in the targeted checkout + #[clap(short, long, default_value = "hard")] + mode: String, } fn main() { @@ -104,7 +120,7 @@ fn main() { match args.commands { Commands::Init(init) => { - init::init_and_hook(init.hooks, &init.compression); + init::init_and_hook(init.hooks, &init.compression, &init.mode); } Commands::Commit(commit) => { commit::commit(commit.compression, String::from(""), commit.update); @@ -119,7 +135,7 @@ fn main() { checkout::checkout(&co.mode); } Commands::CreateHooks(ch) => { - create_hooks::create_hooks(&ch.compression); + create_hooks::create_hooks(&ch.compression, &ch.mode); } } } -- GitLab