chore: merge 0.0.6 #6
2 changed files with 51 additions and 32 deletions
41
src/git.rs
41
src/git.rs
|
@ -236,6 +236,9 @@ impl Config {
|
|||
/// Runs associated function on all repos in config
|
||||
///
|
||||
/// TODO: need to be made over a generic repo type
|
||||
///
|
||||
/// NOTE: currently unused
|
||||
///
|
||||
fn on_all<F>(&self, f: F)
|
||||
where
|
||||
F: Fn(&GitRepo),
|
||||
|
@ -262,6 +265,29 @@ impl Config {
|
|||
}
|
||||
}
|
||||
}
|
||||
/// Runs associated function on all repos in config
|
||||
///
|
||||
/// TODO: need to be made over a generic repo type
|
||||
///
|
||||
/// NOTE: currently unused
|
||||
///
|
||||
/// # Current Problem
|
||||
///
|
||||
/// The goal of this function is that it should run some function on all
|
||||
/// repos but stop executing further functions on any repo that fails,
|
||||
/// without blocking the repos that don't have an issue.
|
||||
///
|
||||
/// This is actually somewhat hairy to do, at least at 6:16 am :S
|
||||
fn series_on_all<F>(&self, f: F)
|
||||
where
|
||||
F: Fn(&GitRepo),
|
||||
{
|
||||
for (_, category) in self.categories.iter() {
|
||||
for (_, repo) in category.repos.iter() {
|
||||
f(repo);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Tries to pull all repositories, skips if fail.
|
||||
pub fn pull_all(&self) {
|
||||
debug!("exectuting pull_all");
|
||||
|
@ -291,17 +317,10 @@ impl Config {
|
|||
/// repositories, skips if fail.
|
||||
pub fn quick(&self, msg: &String) {
|
||||
debug!("exectuting quick");
|
||||
self.on_all(|repo| {
|
||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: pull", repo.name).into());
|
||||
repo.pull();
|
||||
sp = Spinner::new(Spinners::Dots10, format!("{}: add_all", repo.name).into());
|
||||
repo.add_all();
|
||||
sp = Spinner::new(Spinners::Dots10, format!("{}: commit", repo.name).into());
|
||||
repo.commit_with_msg(msg);
|
||||
sp = Spinner::new(Spinners::Dots10, format!("{}: push", repo.name).into());
|
||||
repo.push();
|
||||
sp.stop_and_persist("✔", format!("{}: quick", repo.name).into());
|
||||
});
|
||||
self.on_all_spinner("pull", |repo| repo.pull());
|
||||
self.on_all_spinner("add", |repo| repo.add_all());
|
||||
self.on_all_spinner("commit", |repo| repo.commit_with_msg(msg));
|
||||
self.on_all_spinner("push", |repo| repo.push());
|
||||
}
|
||||
|
||||
/* LINK RELATED */
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
categories:
|
||||
config:
|
||||
flags: []
|
||||
repos:
|
||||
qmk_firmware:
|
||||
name: qmk_firmware
|
||||
path: /home/ces/org/src/git/
|
||||
url: git@github.com:cafkafk/qmk_firmware.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
starship:
|
||||
name: starship
|
||||
path: /home/ces/org/src/git/
|
||||
url: https://github.com/starship/starship.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
utils:
|
||||
flags: []
|
||||
repos:
|
||||
gg:
|
||||
name: gg
|
||||
path: /home/ces/.dots/
|
||||
url: git@github.com:cafkafk/gg.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
li:
|
||||
name: li
|
||||
path: /home/ces/org/src/git/
|
||||
|
@ -26,10 +16,20 @@ categories:
|
|||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
gg:
|
||||
name: gg
|
||||
path: /home/ces/.dots/
|
||||
url: git@github.com:cafkafk/gg.git
|
||||
config:
|
||||
flags: []
|
||||
repos:
|
||||
starship:
|
||||
name: starship
|
||||
path: /home/ces/org/src/git/
|
||||
url: https://github.com/starship/starship.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
qmk_firmware:
|
||||
name: qmk_firmware
|
||||
path: /home/ces/org/src/git/
|
||||
url: git@github.com:cafkafk/qmk_firmware.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
|
|
Loading…
Reference in a new issue