From 301c604f37f3dcaa8cf1313ffe6fd5ded8a30e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sat, 1 Jul 2023 05:45:03 +0200 Subject: [PATCH] feat(git): added pull flag Added the pull flag to the repo logic. Now you can pull only some repos. --- src/git.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/git.rs b/src/git.rs index 48792a5..56beb02 100644 --- a/src/git.rs +++ b/src/git.rs @@ -32,7 +32,7 @@ use std::{fs, process::Command}; pub enum RepoFlags { Push, Clone, - // Pull, FIXME: could be interesting to implement + Pull, } /// Represents the config.toml file. @@ -136,11 +136,15 @@ impl GitRepo { } /// Pulls the repository if able. fn pull(&self) { - let out = Command::new("git") - .current_dir(format!("{}{}", &self.path, &self.name)) - .arg("pull") - .output() - .unwrap_or_else(|_| panic!("git repo failed to pull: {:?}", &self,)); + if self.flags.contains(&RepoFlags::Pull) { + let out = Command::new("git") + .current_dir(format!("{}{}", &self.path, &self.name)) + .arg("pull") + .output() + .unwrap_or_else(|_| panic!("git repo failed to pull: {:?}", &self,)); + } else { + info!("{} has clone set to false, not pulled", &self.name); + } // info!("{out}"); } /// Adds all files in the repository.