Skip to content

Commit

Permalink
[FEATURE] If the value is required: allow for values in the format of…
Browse files Browse the repository at this point in the history
… the parameter
  • Loading branch information
hasherezade committed Dec 28, 2021
1 parent 2a86877 commit 1821134
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paramkit/include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ namespace paramkit {
}
}
if (param_str == param->argStr) {
// has argument:
const bool hasArg = (i + 1) < argc && !(isParam(to_string(argv[i + 1])));
// has an argument:
const bool hasArg = (i + 1) < argc &&
( param->requiredArg || !(isParam(to_string(argv[i + 1]))) );
if (hasArg) {
const std::string nextVal = to_string(argv[i + 1]);
i++; // icrement index: move to the next argument
Expand Down

0 comments on commit 1821134

Please sign in to comment.