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,13 +37,9 @@ ParametersParser::ParametersParser(ParameterList params,
throw runtime_error{format("switch '-{}' specified more than once", it->key)};
switch_seen[switch_index] = true;
if (it->value.takes_arg)
{
++i;
if (i == params.size() or params[i][0_byte] == '-')
if (it->value.takes_arg and ++i == params.size())
throw missing_option_value(it->key);
}
}
else // positional
{
if (desc.flags & ParameterDesc::Flags::SwitchesOnlyAtStart)