Skip to content

Commit

Permalink
Accept '-' as an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jhanssen committed Nov 17, 2016
1 parent 72f0932 commit 4ff5de9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CommandLineParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ParseStatus parse(int argc, char **argv,
status = handler(opt->option, std::move(value), i, args);
break;
case Optional:
if (value.isEmpty() && i + 1 < args.size() && !args.at(i + 1).startsWith('-'))
if (value.isEmpty() && i + 1 < args.size() && (!args.at(i + 1).startsWith('-') || args.at(i + 1).size() == 1))
value = args.at(++i);
status = handler(opt->option, std::move(value), i, args);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/RClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ CommandLineParser::ParseStatus RClient::parse(size_t argc, char **argv)
print(CXCursor_FirstPreprocessing, CXCursor_LastPreprocessing);
return { String(), CommandLineParser::Parse_Ok }; }
case SetBuffers: {
String arg = 0;
String arg;
if (!value.isEmpty()) {
arg = std::move(value);
} else if (idx < arguments.size() && (arguments[idx][0] != '-' || arguments[idx] == "-")) {
Expand Down

0 comments on commit 4ff5de9

Please sign in to comment.