From 94ed510bd03b50978d5de6afdb5d7d465cb3a3f9 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Wed, 11 May 2022 11:33:07 +0200 Subject: [PATCH] src/main.rs: add checkout subcommand --- src/main.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main.rs b/src/main.rs index 12d821a..e0f0e6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,9 @@ enum Commands { /// Check if a checkout can be performed without losing data #[clap(name = "pre-co")] PreCo, + /// Checkout results to the current git commit + #[clap(alias = "co")] + Checkout(Checkout), } #[derive(Debug, Args)] @@ -52,6 +55,18 @@ struct List { archive: String, } +#[derive(Debug, Args)] +struct Checkout { + /// The checkout mode: hard or soft + /// + /// 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 = "soft")] + mode: String, +} + fn main() { let args = Cli::parse(); @@ -68,5 +83,8 @@ fn main() { Commands::PreCo => { checkout::prepare_checkout(); } + Commands::Checkout(co) => { + checkout::checkout(&co.mode); + } } } -- GitLab