Do not reject switch parameters starting with -

Closes #1193
This commit is contained in:
Maxime Coste 2017-07-23 23:21:51 +02:00
parent d75a835ca1
commit 5eb63a32e5

View File

@ -37,12 +37,8 @@ ParametersParser::ParametersParser(ParameterList params,
throw runtime_error{format("switch '-{}' specified more than once", it->key)}; throw runtime_error{format("switch '-{}' specified more than once", it->key)};
switch_seen[switch_index] = true; switch_seen[switch_index] = true;
if (it->value.takes_arg) if (it->value.takes_arg and ++i == params.size())
{ throw missing_option_value(it->key);
++i;
if (i == params.size() or params[i][0_byte] == '-')
throw missing_option_value(it->key);
}
} }
else // positional else // positional
{ {