ArgumentParser: Parse short value arguments
This commit is contained in:
parent
9b8996adeb
commit
f1e2937528
@ -115,11 +115,29 @@ Result<Vector<StringView>> ArgumentParser::parse(int argc, char* const* argv)
|
||||
{
|
||||
StringView flags = &arg[1];
|
||||
|
||||
for (char c : flags)
|
||||
for (usize j = 0; j < flags.length(); j++)
|
||||
{
|
||||
char c = flags[j];
|
||||
bool found = false;
|
||||
|
||||
// FIXME: Implement value arguments for short flags.
|
||||
// Last flag, this could be a value flag
|
||||
if (j + 1 == flags.length())
|
||||
{
|
||||
for (const auto& current : m_value_args)
|
||||
{
|
||||
if (current.short_flag == ' ') continue;
|
||||
|
||||
if (current.short_flag == c)
|
||||
{
|
||||
current_value_argument = current;
|
||||
is_parsing_value_argument = true;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) continue;
|
||||
}
|
||||
|
||||
for (const auto& current : m_switch_args)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user