1
Fork 0
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:
Andreas Kling 2021-04-29 11:10:06 +02:00
parent 889e1d3db9
commit 695cdf7bc0
2 changed files with 16 additions and 0 deletions

View file

@ -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));
}
}