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

src/main.rs: add mode parameter in init

parent d9008695
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,14 @@ struct Init { ...@@ -56,6 +56,14 @@ struct Init {
/// The compression to use automatically at each commit if hooks are created /// The compression to use automatically at each commit if hooks are created
#[clap(short, long, default_value = "lz4")] #[clap(short, long, default_value = "lz4")]
compression: String, 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)] #[derive(Debug, Args)]
...@@ -97,6 +105,14 @@ struct CreateHooks { ...@@ -97,6 +105,14 @@ struct CreateHooks {
/// The compression that will automatically be used after each commit /// The compression that will automatically be used after each commit
#[clap(short, long, default_value = "lz4")] #[clap(short, long, default_value = "lz4")]
compression: String, 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() { fn main() {
...@@ -104,7 +120,7 @@ fn main() { ...@@ -104,7 +120,7 @@ fn main() {
match args.commands { match args.commands {
Commands::Init(init) => { Commands::Init(init) => {
init::init_and_hook(init.hooks, &init.compression); init::init_and_hook(init.hooks, &init.compression, &init.mode);
} }
Commands::Commit(commit) => { Commands::Commit(commit) => {
commit::commit(commit.compression, String::from(""), commit.update); commit::commit(commit.compression, String::from(""), commit.update);
...@@ -119,7 +135,7 @@ fn main() { ...@@ -119,7 +135,7 @@ fn main() {
checkout::checkout(&co.mode); checkout::checkout(&co.mode);
} }
Commands::CreateHooks(ch) => { Commands::CreateHooks(ch) => {
create_hooks::create_hooks(&ch.compression); create_hooks::create_hooks(&ch.compression, &ch.mode);
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment