feat(git): added pull flag
Added the pull flag to the repo logic. Now you can pull only some repos.
This commit is contained in:
parent
18e062010e
commit
301c604f37
1 changed files with 10 additions and 6 deletions
16
src/git.rs
16
src/git.rs
|
@ -32,7 +32,7 @@ use std::{fs, process::Command};
|
||||||
pub enum RepoFlags {
|
pub enum RepoFlags {
|
||||||
Push,
|
Push,
|
||||||
Clone,
|
Clone,
|
||||||
// Pull, FIXME: could be interesting to implement
|
Pull,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the config.toml file.
|
/// Represents the config.toml file.
|
||||||
|
@ -136,11 +136,15 @@ impl GitRepo {
|
||||||
}
|
}
|
||||||
/// Pulls the repository if able.
|
/// Pulls the repository if able.
|
||||||
fn pull(&self) {
|
fn pull(&self) {
|
||||||
let out = Command::new("git")
|
if self.flags.contains(&RepoFlags::Pull) {
|
||||||
.current_dir(format!("{}{}", &self.path, &self.name))
|
let out = Command::new("git")
|
||||||
.arg("pull")
|
.current_dir(format!("{}{}", &self.path, &self.name))
|
||||||
.output()
|
.arg("pull")
|
||||||
.unwrap_or_else(|_| panic!("git repo failed to pull: {:?}", &self,));
|
.output()
|
||||||
|
.unwrap_or_else(|_| panic!("git repo failed to pull: {:?}", &self,));
|
||||||
|
} else {
|
||||||
|
info!("{} has clone set to false, not pulled", &self.name);
|
||||||
|
}
|
||||||
// info!("{out}");
|
// info!("{out}");
|
||||||
}
|
}
|
||||||
/// Adds all files in the repository.
|
/// Adds all files in the repository.
|
||||||
|
|
Loading…
Reference in a new issue