Add config flag to toggle verbose Git repository output. (#763)

* Add config flag to toggle verbose Git repository output.

If `true`: the default, no change.

If `false`: Only show repositories that have been updated or have an error.

Minor tweak to output (removed colon) so that copy and paste for 'cd' is nicer.
This commit is contained in:
Dan Sully
2024-04-13 19:28:03 -07:00
committed by GitHub
parent ecf8fb7a47
commit 9b0681f3b8
3 changed files with 21 additions and 5 deletions

View File

@@ -295,7 +295,9 @@ impl RepoStep {
async fn pull_repo<P: AsRef<Path>>(&self, ctx: &ExecutionContext<'_>, repo: P) -> Result<()> {
let before_revision = get_head_revision(&self.git, &repo);
println!("{} {}", style("Pulling").cyan().bold(), repo.as_ref().display());
if ctx.config().verbose() {
println!("{} {}", style("Pulling").cyan().bold(), repo.as_ref().display());
}
let mut command = AsyncCommand::new(&self.git);
@@ -326,7 +328,7 @@ impl RepoStep {
match (&before_revision, &after_revision) {
(Some(before), Some(after)) if before != after => {
println!("{} {}:", style("Changed").yellow().bold(), repo.as_ref().display());
println!("{} {}", style("Changed").yellow().bold(), repo.as_ref().display());
Command::new(&self.git)
.stdin(Stdio::null())
@@ -342,7 +344,9 @@ impl RepoStep {
println!();
}
_ => {
println!("{} {}", style("Up-to-date").green().bold(), repo.as_ref().display());
if ctx.config().verbose() {
println!("{} {}", style("Up-to-date").green().bold(), repo.as_ref().display());
}
}
}
}
@@ -364,6 +368,13 @@ impl RepoStep {
return Ok(());
}
if !ctx.config().verbose() {
println!(
"\n{} updated repositories will be shown...\n",
style("Only").green().bold()
);
}
let futures_iterator = self
.repos
.iter()