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 global --quiet flag to suppress non-primary output #3401

Merged
merged 6 commits into from
Apr 1, 2024

Conversation

martinvonz
Copy link
Owner

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

Copy link
Collaborator

@thoughtpolice thoughtpolice left a comment

Choose a reason for hiding this comment

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

lgtm

cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/ui.rs Outdated Show resolved Hide resolved
cli/src/formatter.rs Outdated Show resolved Hide resolved
@martinvonz martinvonz force-pushed the push-qwwlkuwzzosl branch 2 times, most recently from 4c2da99 to 118e7db Compare April 1, 2024 05:11
@martinvonz martinvonz force-pushed the push-qwwlkuwzzosl branch 3 times, most recently from b0696ff to 08bee8a Compare April 1, 2024 06:10
@martinvonz
Copy link
Owner Author

I had forgotten to update the setting in Ui::reset() so the flag didn't take effect. That's now fixed.

Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

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

Thanks for updating patches.

cli/src/commands/rebase.rs Outdated Show resolved Hide resolved
cli/src/ui.rs Show resolved Hide resolved
This clarifies that status messages are not errors, and allows us to
implement a global `--quiet` flag for silencing status messages.
I'm about to make hints not get printed with `--quiet`, but error
hints are probably still useful to get. They shouldn't be a problem
for scripts since the script would have to deal with the error anyway.
When the caller needs a formatter, it's because they're doing
something non-trivial. When the user passed `--quiet` (see upcoming
patch), we should ideally skip doing related work for print the
formatting output. It helps if the `Ui` object doesn't even return a
`Formatter` then, so the caller is forced to handle the quiet case
differently.

Thanks to Yuya for the suggestion.
Same reasoning as the previous patch: we can avoid doing work when
`--quiet` is passed.
Note that `jj resolve` already had its own `--quiet` flag. The output
with `--quiet` for that command got a lot quieter with the global
`--quiet` also taking effect. That seems reasonable to me.
@martinvonz martinvonz merged commit 7b3f8e8 into main Apr 1, 2024
16 checks passed
@martinvonz martinvonz deleted the push-qwwlkuwzzosl branch April 1, 2024 20:00
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.

4 participants