We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 201e2c8 + 2489225 commit 980154cCopy full SHA for 980154c
1 file changed
argparse.h
@@ -119,9 +119,14 @@ class ArgumentParser {
119
if (!_help) {
120
for (auto &a : _arguments) {
121
if (a._required) {
122
- if (_variables.find(a._name) == _variables.end()
123
- && _variables.find(_pairs.find(a._name)->second) == _variables.end()) {
124
- throw ArgumentNotFound(a, _pairs);
+ if (_variables.find(a._name) == _variables.end()) {
+ // Check if a pair name does not exist. If it does exist check that
+ // there is not a variable with that name
125
+ if (_pairs.find(a._name) == _pairs.end() ||
126
+ _variables.find(_pairs.find(a._name)->second) ==
127
+ _variables.end()) {
128
+ throw ArgumentNotFound(a, _pairs);
129
+ }
130
}
131
132
0 commit comments