Skip to content

Commit

Permalink
nix: Add quiet flag with shortName overriding its common variant
Browse files Browse the repository at this point in the history
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 ...`.
  • Loading branch information
shivaraj-bh committed Oct 7, 2024
1 parent 26c3fc1 commit efc597c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nix/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
.handler = {[this]() { this->helpRequested = true; }},
});

addFlag({
.longName = "quiet",
.shortName = 'q',
.description = "Decrease the logging verbosity level.",
.category = loggingCategory,
.handler = {[]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }},
});

addFlag({
.longName = "print-build-logs",
.shortName = 'L',
Expand Down

0 comments on commit efc597c

Please sign in to comment.