aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2024-05-14 12:13:40 -0700
committerMaximilian Bosch <maximilian@mbosch.me>2024-05-30 03:07:21 +0000
commit031d92411637904a8ed759dc80bc474213dd4fa9 (patch)
treeb01c2401c71daeb868dbc8996dc34eb3482a4178 /src/libutil
parent218630a241d71ea5c136f72e1aaaf2299df6a0b1 (diff)
libutil/args: warn on unknown settings after parsing all flags
Upstream change: https://github.com/NixOS/nix/pull/10701 Change-Id: Icf271df57ec529dd8c64667d1ef9f6dbf02d33d3
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/args.cc8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 4983e49af..655b3e82f 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -93,7 +93,6 @@ void RootArgs::parseCmdline(const Strings & _cmdline)
verbosity = lvlError;
}
- bool argsSeen = false;
for (auto pos = cmdline.begin(); pos != cmdline.end(); ) {
auto arg = *pos;
@@ -122,10 +121,6 @@ void RootArgs::parseCmdline(const Strings & _cmdline)
throw UsageError("unrecognised flag '%1%'", arg);
}
else {
- if (!argsSeen) {
- argsSeen = true;
- initialFlagsProcessed();
- }
pos = rewriteArgs(cmdline, pos);
pendingArgs.push_back(*pos++);
if (processArgs(pendingArgs, false))
@@ -135,8 +130,7 @@ void RootArgs::parseCmdline(const Strings & _cmdline)
processArgs(pendingArgs, true);
- if (!argsSeen)
- initialFlagsProcessed();
+ initialFlagsProcessed();
/* Now that we are done parsing, make sure that any experimental
* feature required by the flags is enabled */