diff --git a/src/ppx/command_line_parser.cpp b/src/ppx/command_line_parser.cpp index 4fa47b2a4..a1a7399ff 100644 --- a/src/ppx/command_line_parser.cpp +++ b/src/ppx/command_line_parser.cpp @@ -79,15 +79,16 @@ std::optional CommandLineParser::Parse(int argc, std::vector args; for (size_t i = 1; i < argc; ++i) { std::string_view argString(argv[i]); - if (argString.find('=') != std::string_view::npos) { - auto res = ppx::string_util::SplitInTwo(argString, '='); - if (res == std::nullopt) { - return "Malformed flag with '=': \"" + std::string(argString) + "\""; - } - args.emplace_back(res->first); - args.emplace_back(res->second); + if (argString.find('=') == std::string_view::npos) { + args.emplace_back(argString); + continue; + } + auto res = ppx::string_util::SplitInTwo(argString, '='); + if (res == std::nullopt) { + return "Malformed flag with '=': \"" + std::string(argString) + "\""; } - args.emplace_back(argString); + args.emplace_back(res->first); + args.emplace_back(res->second); } // Another pass to identify JSON config files, add that option, and remove it from the argument list @@ -182,9 +183,7 @@ std::optional CommandLineParser::ParseJson(CliOp ss << it.value(); std::string value = ss.str(); ss.str(""); - if (auto error = ParseOption(cliOptions, it.key(), ppx::string_util::TrimBothEnds(value, " \t\""))) { - return error; - } + cliOptions.AddOption(it.key(), ppx::string_util::TrimBothEnds(value, " \t\"")); } return std::nullopt; }