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

@@ -1,4 +1,9 @@
# Configutation
# Git: Pull Repos
1. The output of "Pulling <repository path>" has been moved behind the
--verbose flag / [misc] configuration block.
# Configuration
1. The `enable_winget` configuration entry in the `windows` section has been
removed because it will not cause any issues and will be enabled by default.

View File

@@ -109,7 +109,7 @@
# greedy_cask = true
# For the BrewCask step
# If `Repo Cask Upgrade` does not exist, then use the `--greedy_latest` optoin.
# If `Repo Cask Upgrade` does not exist, then use the `--greedy_latest` option.
# NOTE: the above entry `greedy_cask` contains this entry, though you can enable
# both of them, they won't clash with each other.
# greedy_latest = true

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()