mirror of
https://github.com/mawww/kakoune.git
synced 2025-01-08 04:47:07 +03:00
parent
9e0f085b86
commit
0a1cb4b9b1
@ -19,6 +19,7 @@ ParametersParser::ParametersParser(ParameterList params,
|
||||
m_desc(desc)
|
||||
{
|
||||
bool only_pos = desc.flags & ParameterDesc::Flags::SwitchesAsPositional;
|
||||
Vector<bool> switch_seen(desc.switches.size(), false);
|
||||
for (size_t i = 0; i < params.size(); ++i)
|
||||
{
|
||||
if (not only_pos and params[i] == "--")
|
||||
@ -29,6 +30,11 @@ ParametersParser::ParametersParser(ParameterList params,
|
||||
if (it == m_desc.switches.end())
|
||||
throw unknown_option(params[i]);
|
||||
|
||||
auto switch_index = it - m_desc.switches.begin();
|
||||
if (switch_seen[switch_index])
|
||||
throw runtime_error{format("switch '-{}' specified more than once", it->key)};
|
||||
switch_seen[switch_index] = true;
|
||||
|
||||
if (it->value.takes_arg)
|
||||
{
|
||||
++i;
|
||||
|
Loading…
Reference in New Issue
Block a user