Skip to content

Commit

Permalink
Fix option parser's long option handling
Browse files Browse the repository at this point in the history
Long option names were only compared to known options based on the length
of the option name given in the arguments, resulting in strange matches,
e.g., '--step' was matching '--steps'.

Signed-off-by: Christoph Niethammer <[email protected]>
  • Loading branch information
cniethammer committed Dec 6, 2024
1 parent 0e08636 commit 98597e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/OptionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const Option& OptionParser::lookup_long_opt(const std::string& opt) const {

std::list<std::string> matching;
for (optMap::const_iterator it = _optmap_l.begin(); it != _optmap_l.end(); ++it) {
if (it->first.compare(0, opt.length(), opt) == 0)
if (it->first == opt)
matching.push_back(it->first);
}
if (matching.size() > 1) {
Expand Down

0 comments on commit 98597e0

Please sign in to comment.