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 shortName for quiet flag #11652

Closed
wants to merge 1 commit into from

Conversation

shivaraj-bh
Copy link
Member

@shivaraj-bh shivaraj-bh commented Oct 7, 2024

Motivation

This PR adds q as a shortName for the quiet flag for nix
command, overriding

addFlag({
.longName = "quiet",
.description = "Decrease the logging verbosity level.",
.category = loggingCategory,
.handler = {[]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }},
});
.
Since this flag can be repeated, it simplifies usage by allowing nix -qq ... instead of nix --quiet --quiet ....

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

srid added a commit to juspay/omnix that referenced this pull request Oct 7, 2024
@cole-h
Copy link
Member

cole-h commented Oct 7, 2024

How does this interact with nix-store --query, which has -q as a short flag?

@shivaraj-bh
Copy link
Member Author

shivaraj-bh commented Oct 7, 2024

How does this interact with nix-store --query, which has -q as a short flag?

I overlooked that. That explains why the CI is failing.

In that case, adding the flag with shortName to only nix command should work? i.e in

NixArgs() : MultiCommand("", RegisterCommand::getCommandsFor({})), MixCommonArgs("nix")

srid added a commit to juspay/omnix that referenced this pull request Oct 7, 2024
Resolves #209 

PRs filed tangential to this:
- NixOS/nix#11652

---------

Co-authored-by: Sridhar Ratnakumar <srid@srid.ca>
This PR adds `q` as a `shortName` for the `quiet` flag for `nix`
command, overriding
https://github.com/NixOS/nix/blob/26c3fc11eada3fa7df0284190095868a947fefe2/src/libmain/common-args.cc#L23-L28.
Since this flag can be repeated, it simplifies usage by allowing `nix
-qq ...` instead of `nix --quiet --quiet ...`.
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Oct 7, 2024
@edolstra
Copy link
Member

edolstra commented Oct 8, 2024

I feel that --quiet is probably not used often enough to justify having it as a one-character flag. Especially since the new CLI by default isn't very verbose anyway.

@tomberek
Copy link
Contributor

tomberek commented Oct 9, 2024

Discussed in meeting:

  • implementation is not quite right for overriding the common-args
  • random historical note: "-q" for query came from the original RPM CLI interface
  • "--quiet" already exists
  • "-q" for quiet is not likely to be used often

Decision: CLOSE, reopen if we have additional user requests for the short flag or more use-cases come to light

@tomberek tomberek closed this Oct 9, 2024
@Ericson2314
Copy link
Member

Ericson2314 commented Oct 9, 2024

https://github.com/NixOS/nix/blob/master/CONTRIBUTING.md#making-changes-to-nix See also the guidance here re misc new features. Ideally one maintainers could handle this async, but we're not very good at that, so instead these things gum up our delicate process. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants