1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 16:31:47 +02:00

Merge pull request #11142 from detroyejr/fix-alias-flags

Allow flag aliases
This commit is contained in:
Eelco Dolstra 2024-07-22 15:53:41 +02:00 committed by GitHub
commit 40f80e1b5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 23 additions and 0 deletions

View file

@ -81,6 +81,7 @@ void BaseSetting<T>::convertToArg(Args & args, const std::string & category)
{
args.addFlag({
.longName = name,
.aliases = aliases,
.description = fmt("Set the `%s` setting.", name),
.category = category,
.labels = {"value"},
@ -91,6 +92,7 @@ void BaseSetting<T>::convertToArg(Args & args, const std::string & category)
if (isAppendable())
args.addFlag({
.longName = "extra-" + name,
.aliases = aliases,
.description = fmt("Append to the `%s` setting.", name),
.category = category,
.labels = {"value"},

View file

@ -292,6 +292,7 @@ template<> void BaseSetting<bool>::convertToArg(Args & args, const std::string &
{
args.addFlag({
.longName = name,
.aliases = aliases,
.description = fmt("Enable the `%s` setting.", name),
.category = category,
.handler = {[this] { override(true); }},
@ -299,6 +300,7 @@ template<> void BaseSetting<bool>::convertToArg(Args & args, const std::string &
});
args.addFlag({
.longName = "no-" + name,
.aliases = aliases,
.description = fmt("Disable the `%s` setting.", name),
.category = category,
.handler = {[this] { override(false); }},