addFlag: use aliases

This commit is contained in:
detroyejr 2024-07-18 18:30:31 -04:00
parent 8ce4287409
commit 74dccef004
3 changed files with 7 additions and 0 deletions

View File

@ -304,18 +304,21 @@ template<> void BaseSetting<SandboxMode>::convertToArg(Args & args, const std::s
{
args.addFlag({
.longName = name,
.aliases = aliases,
.description = "Enable sandboxing.",
.category = category,
.handler = {[this]() { override(smEnabled); }}
});
args.addFlag({
.longName = "no-" + name,
.aliases = aliases,
.description = "Disable sandboxing.",
.category = category,
.handler = {[this]() { override(smDisabled); }}
});
args.addFlag({
.longName = "relaxed-" + name,
.aliases = aliases,
.description = "Enable sandboxing, but allow builds to disable it.",
.category = category,
.handler = {[this]() { override(smRelaxed); }}

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); }},