Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Apr 14, 2024

Conversation

dsully
Copy link
Contributor

@dsully dsully commented Apr 2, 2024

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.

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step
  • Optional: The --yes option works with this step if it is supported by
    the underlying command

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

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.
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

I wonder can we do this with logs? Then we can toggle them via log level, Topgrade already has a --verbose option, IMHO, it would match this well

@dsully
Copy link
Contributor Author

dsully commented Apr 13, 2024

Hi!

I wonder can we do this with logs? Then we can toggle them via log level, Topgrade already has a --verbose option, IMHO, it would match this well

Easy enough! Just pushed a new commit.

Copy link

codecov bot commented Apr 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 6.61%. Comparing base (ab21600) to head (39f3b72).
Report is 3 commits behind head on main.

Files Patch % Lines
src/steps/git.rs 0.00% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #763      +/-   ##
========================================
+ Coverage   5.02%   6.61%   +1.59%     
========================================
  Files         37      37              
  Lines      12114   12180      +66     
========================================
+ Hits         609     806     +197     
+ Misses     11505   11374     -131     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I consider this as a breaking change, could you please document it in BREAKINGCHANGES_dev.md, here is a guideline on how to add it: https://github.com/topgrade-rs/topgrade/blob/main/CONTRIBUTING.md#breaking-changes

src/steps/git.rs Outdated
@@ -292,10 +292,12 @@ impl RepoStep {
}

/// Try to pull a repo.
async fn pull_repo<P: AsRef<Path>>(&self, ctx: &ExecutionContext<'_>, repo: P) -> Result<()> {
async fn pull_repo<P: AsRef<Path>>(&self, ctx: &ExecutionContext<'_>, repo: P, verbose: bool) -> Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need an extra argument here, we can access the --verbose option through ctx.config().verbose()


if !verbose {
println!("\n{} updated repositories will be shown...\n", style("Only").green().bold());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda think it is unnecessary to inform users of this on every run, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way. It's somewhat helpful if you have a lot of repositories to know that something is happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's somewhat helpful if you have a lot of repositories to know that something is happening.

i agree

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx!

@SteveLauC SteveLauC merged commit 9b0681f into topgrade-rs:main Apr 14, 2024
18 of 19 checks passed
InnocentZero pushed a commit to InnocentZero/topgrade that referenced this pull request May 25, 2024
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants