1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

Userland: Use Core::ArgsParser's Vector<StringView> API everywhere

...and remove the Vector<String> variant since there are no remaining
users of this API.
This commit is contained in:
Andreas Kling 2021-11-26 22:32:37 +01:00
parent 395ba619d8
commit f1cc3d0fc4
17 changed files with 31 additions and 47 deletions

View file

@ -147,7 +147,7 @@ TEST_CASE(positional_string_argument)
TEST_CASE(positional_vector_string_argument)
{
// Zero or more positional arguments, zero given
Vector<String> values = {};
Vector<StringView> values;
auto parser_result = run_parser({ "app" }, [&](auto& parser) {
parser.add_positional_argument(values, "values", "values", Core::ArgsParser::Required::No);
});
@ -213,7 +213,7 @@ TEST_CASE(combination_of_bool_options_with_positional_vector_string)
// Expected: all arguments fill as given
bool bool_opt1 = false;
bool bool_opt2 = false;
Vector<String> positionals = {};
Vector<StringView> positionals;
auto parser_result = run_parser({ "app", "-b", "-c", "one", "two" }, [&](auto& parser) {
parser.add_option(bool_opt1, "bool_opt1", nullptr, 'b');
parser.add_option(bool_opt2, "bool_opt2", nullptr, 'c');
@ -318,7 +318,7 @@ TEST_CASE(stop_on_first_non_option)
// Expected: bool options are set and one positional argument is filled
bool bool_opt1 = false;
bool bool_opt2 = false;
Vector<String> positionals = {};
Vector<StringView> positionals;
auto parser_result = run_parser({ "app", "-b", "-c", "one" }, [&](auto& parser) {
parser.set_stop_on_first_non_option(false);
parser.add_option(bool_opt1, "bool_opt1", nullptr, 'b');