From 034c128562119d68a4559745d6f9a6e7c0813336 Mon Sep 17 00:00:00 2001 From: RonxBulld <526677628@qq.com> Date: Wed, 5 May 2021 13:06:37 +0800 Subject: [PATCH] Support the option value is attached after the option without a space in between. e.g. -j5 --- include/cxxopts.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 58d5a3d..00615bb 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -2278,6 +2278,12 @@ OptionParser::parse(int argc, const char* const* argv) { parse_option(value, name, value->value().get_implicit_value()); } + else if (i + 1 < s.size()) + { + std::string arg_value = s.substr(i + 1); + parse_option(value, name, arg_value); + break; + } else { //error