From ac5d7c652beee4b37b1361265c83e961c991a03a Mon Sep 17 00:00:00 2001 From: dragonmux Date: Thu, 11 May 2023 23:40:41 +0100 Subject: [PATCH] Fixed how valued option handling was being parsed --- impl/command_line/arguments.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/impl/command_line/arguments.cxx b/impl/command_line/arguments.cxx index 0d67cc22..f9e5aca0 100644 --- a/impl/command_line/arguments.cxx +++ b/impl/command_line/arguments.cxx @@ -168,10 +168,13 @@ namespace substrate::commandLine // Check if we're parsing a "simple" option if (!option.matches(argument)) return std::nullopt; - const auto &token{lexer.next()}; // If the option matches, try parsing out and validating the value portion if there is one if (!option.takesParameter()) + { + lexer.next(); return flag_t{argument}; + } + const auto &token{lexer.token()}; // Consume tokens to get to the value token if the option is not value-only if (!option.valueOnly()) { @@ -184,6 +187,7 @@ namespace substrate::commandLine } // Try parsing that parameter component as a value for the option auto value{option.parseValue(token.value())}; + lexer.next(); if (!value) // If the operation fails, use monostate to signal match-but-fail. return std::monostate{};