mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibCore: Support Vector<String> positional arguments
We already supported Vector<char const*>, so let's add Vector<String> as well. :^)
This commit is contained in:
parent
889e1d3db9
commit
695cdf7bc0
2 changed files with 16 additions and 0 deletions
|
@ -400,4 +400,19 @@ void ArgsParser::add_positional_argument(Vector<const char*>& values, const char
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(Vector<String>& values, const char* help_string, const char* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
INT_MAX,
|
||||
[&values](const char* s) {
|
||||
values.append(s);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue