Skip to content

Commit

Permalink
libutil/args: warn on unknown settings after parsing all flags
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-h committed May 15, 2024
1 parent e0c9669 commit a53fd51
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/libutil/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ void RootArgs::parseCmdline(const Strings & _cmdline, bool allowShebang)
verbosity = lvlError;
}

bool argsSeen = false;

// Heuristic to see if we're invoked as a shebang script, namely,
// if we have at least one argument, it's the name of an
// executable file, and it starts with "#!".
Expand Down Expand Up @@ -336,10 +334,6 @@ void RootArgs::parseCmdline(const Strings & _cmdline, bool allowShebang)
throw UsageError("unrecognised flag '%1%'", arg);
}
else {
if (!argsSeen) {
argsSeen = true;
initialFlagsProcessed();
}
pos = rewriteArgs(cmdline, pos);
pendingArgs.push_back(*pos++);
if (processArgs(pendingArgs, false))
Expand All @@ -349,8 +343,7 @@ void RootArgs::parseCmdline(const Strings & _cmdline, bool allowShebang)

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 */
Expand Down

0 comments on commit a53fd51

Please sign in to comment.