diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-07-12 22:13:38 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-14 00:24:24 +0100 |
commit | 3d516420378d5015b21c3500e910c1337935ea89 (patch) | |
tree | 3398e8d1c67a561e92db41737eea31bb87273325 | |
parent | 810b9daa63a0568d60232f11bf36d778dd784b5e (diff) | |
download | serenity-3d516420378d5015b21c3500e910c1337935ea89.zip |
LibCore: Replace the ArgsParser option argument setting with an enum
Replacement conditions for `requires_argument` have been chosen based
on what would be most convenient for implementing an eventual optional
argument mode.
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/ArgsParser.cpp | 42 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/ArgsParser.h | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp | 2 | ||||
-rw-r--r-- | Userland/Shell/Builtin.cpp | 26 | ||||
-rw-r--r-- | Userland/Utilities/du.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/grep.cpp | 10 | ||||
-rw-r--r-- | Userland/Utilities/nl.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/pro.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/profile.cpp | 3 | ||||
-rw-r--r-- | Userland/Utilities/run-tests.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/test-unveil.cpp | 4 | ||||
-rw-r--r-- | Userland/Utilities/top.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/wasm.cpp | 4 | ||||
-rw-r--r-- | Userland/Utilities/watch.cpp | 2 |
15 files changed, 59 insertions, 53 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp index e1321c8a9c..bd934bf346 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char** argv) args_parser.add_option(iterator_prototype_header_mode, "Generate the iterator prototype .h file", "iterator-prototype-header", 0); args_parser.add_option(iterator_prototype_implementation_mode, "Generate the iterator prototype .cpp file", "iterator-prototype-implementation", 0); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Add a header search path passed to the compiler", .long_name = "header-include-path", .short_name = 'i', diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index 943fa800f6..b26bf87863 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -60,7 +60,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha if (opt.long_name) { option long_opt { opt.long_name, - opt.requires_argument ? required_argument : no_argument, + opt.argument_mode == OptionArgumentMode::Required ? required_argument : no_argument, &index_of_found_long_option, static_cast<int>(i) }; @@ -68,7 +68,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha } if (opt.short_name) { short_options_builder.append(opt.short_name); - if (opt.requires_argument) + if (opt.argument_mode != OptionArgumentMode::None) short_options_builder.append(':'); } } @@ -103,7 +103,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha } VERIFY(found_option); - char const* arg = found_option->requires_argument ? optarg : nullptr; + char const* arg = found_option->argument_mode != OptionArgumentMode::None ? optarg : nullptr; if (!found_option->accept_value(arg)) { warnln("\033[31mInvalid value for option \033[1m{}\033[22m\033[0m", found_option->name_for_display()); fail(); @@ -200,7 +200,7 @@ void ArgsParser::print_usage_terminal(FILE* file, char const* argv0) for (auto& opt : m_options) { if (opt.hide_mode != OptionHideMode::None) continue; - if (opt.requires_argument) + if (opt.argument_mode == OptionArgumentMode::Required) out(file, " [{} {}]", opt.name_for_display(), opt.value_name); else out(file, " [{}]", opt.name_for_display()); @@ -233,7 +233,7 @@ void ArgsParser::print_usage_terminal(FILE* file, char const* argv0) auto print_argument = [&]() { if (opt.value_name) { - if (opt.requires_argument) + if (opt.argument_mode == OptionArgumentMode::Required) out(file, " {}", opt.value_name); } }; @@ -277,7 +277,7 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0) // FIXME: We allow opt.value_name to be empty even if the option // requires an argument. This should be disallowed as it will // currently display a blank name after the option. - if (opt.requires_argument) + if (opt.argument_mode == OptionArgumentMode::Required) out(file, " [{} {}]", opt.name_for_display(), opt.value_name ?: ""); else out(file, " [{}]", opt.name_for_display()); @@ -320,7 +320,7 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0) auto print_argument = [&]() { if (opt.value_name != nullptr) { - if (opt.requires_argument) + if (opt.argument_mode == OptionArgumentMode::Required) out(file, " {}", opt.value_name); } }; @@ -367,7 +367,7 @@ void ArgsParser::add_option(Option&& option) void ArgsParser::add_ignored(char const* long_name, char short_name, OptionHideMode hide_mode) { Option option { - false, + OptionArgumentMode::None, "Ignored", long_name, short_name, @@ -383,7 +383,7 @@ void ArgsParser::add_ignored(char const* long_name, char short_name, OptionHideM void ArgsParser::add_option(bool& value, char const* help_string, char const* long_name, char short_name, OptionHideMode hide_mode) { Option option { - false, + OptionArgumentMode::None, help_string, long_name, short_name, @@ -401,7 +401,7 @@ void ArgsParser::add_option(bool& value, char const* help_string, char const* lo void ArgsParser::add_option(char const*& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -418,7 +418,7 @@ void ArgsParser::add_option(char const*& value, char const* help_string, char co void ArgsParser::add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -435,7 +435,7 @@ void ArgsParser::add_option(String& value, char const* help_string, char const* void ArgsParser::add_option(StringView& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -452,7 +452,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con void ArgsParser::add_option(int& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -470,7 +470,7 @@ void ArgsParser::add_option(int& value, char const* help_string, char const* lon void ArgsParser::add_option(unsigned& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -488,7 +488,7 @@ void ArgsParser::add_option(unsigned& value, char const* help_string, char const void ArgsParser::add_option(double& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -506,7 +506,7 @@ void ArgsParser::add_option(double& value, char const* help_string, char const* void ArgsParser::add_option(Optional<double>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -523,7 +523,7 @@ void ArgsParser::add_option(Optional<double>& value, char const* help_string, ch void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -540,7 +540,7 @@ void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, ch void ArgsParser::add_option(Vector<size_t>& values, char const* help_string, char const* long_name, char short_name, char const* value_name, char separator, OptionHideMode hide_mode) { Option option { - true, + OptionArgumentMode::Required, help_string, long_name, short_name, @@ -754,7 +754,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con if (it.is_end()) continue; - if (it->requires_argument) + if (it->argument_mode == OptionArgumentMode::Required) skip_next = true; continue; } @@ -775,7 +775,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con if (it.is_end()) continue; - if (it->requires_argument) + if (it->argument_mode == OptionArgumentMode::Required) skip_next = true; continue; } @@ -791,7 +791,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span<char con object.set("static_offset", 0); object.set("invariant_offset", has_invariant ? option_to_complete.length() : 0u); object.set("display_trivia", option.help_string); - object.set("trailing_trivia", option.requires_argument ? " " : ""); + object.set("trailing_trivia", option.argument_mode == OptionArgumentMode::Required ? " " : ""); outln(file, "{}", object.to_string()); }; diff --git a/Userland/Libraries/LibCore/ArgsParser.h b/Userland/Libraries/LibCore/ArgsParser.h index 5caaee33db..68fbbc4b77 100644 --- a/Userland/Libraries/LibCore/ArgsParser.h +++ b/Userland/Libraries/LibCore/ArgsParser.h @@ -30,6 +30,11 @@ public: Ignore, }; + enum class OptionArgumentMode { + None, + Required, + }; + /// When an option is hidden. /// If the hide mode is not None, then it's always hidden from the usage/synopsis. enum class OptionHideMode { @@ -39,7 +44,7 @@ public: }; struct Option { - bool requires_argument { true }; + OptionArgumentMode argument_mode { OptionArgumentMode::Required }; char const* help_string { nullptr }; char const* long_name { nullptr }; char short_name { 0 }; diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp index 45cbd8bc40..9496615516 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp +++ b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) Core::ArgsParser args_parser; args_parser.add_option(print_times, "Show duration of each test", "show-time", 't'); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Show progress with OSC 9 (true, false)", .long_name = "show-progress", .short_name = 'p', diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index 7c8bfa9d97..a0409ed3a2 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -1288,7 +1288,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }; parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Stop processing arguments after a non-argument parameter is seen", .long_name = "stop-on-first-non-option", .accept_value = [&](auto) { @@ -1297,7 +1297,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the general help string for the parser", .long_name = "general-help", .value_name = "string", @@ -1307,7 +1307,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Start describing an option", .long_name = "add-option", .value_name = "variable-name", @@ -1326,7 +1326,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Accept multiple of the current option being given", .long_name = "list", .accept_value = [&](auto) { @@ -1339,7 +1339,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Define the type of the option or argument being described", .long_name = "type", .value_name = "type", @@ -1379,7 +1379,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the help string of the option or argument being defined", .long_name = "help-string", .value_name = "string", @@ -1396,7 +1396,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the long name of the option being defined", .long_name = "long-name", .value_name = "name", @@ -1415,7 +1415,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the short name of the option being defined", .long_name = "short-name", .value_name = "char", @@ -1438,7 +1438,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the value name of the option being defined", .long_name = "value-name", .value_name = "string", @@ -1473,7 +1473,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Start describing a positional argument", .long_name = "add-positional-argument", .value_name = "variable", @@ -1492,7 +1492,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the minimum required number of positional arguments for the argument being described", .long_name = "min", .value_name = "n", @@ -1520,7 +1520,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Set the maximum required number of positional arguments for the argument being described", .long_name = "max", .value_name = "n", @@ -1548,7 +1548,7 @@ int Shell::builtin_argsparser_parse(int argc, char const** argv) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Mark the positional argument being described as required (shorthand for --min 1)", .long_name = "required", .accept_value = [&](auto) { diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index f5abd7297e..1e4c271f7c 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -59,7 +59,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt Vector<StringView> files_to_process; Core::ArgsParser::Option time_option { - true, + Core::ArgsParser::OptionArgumentMode::Required, "Show time of type time-type of any file in the directory, or any of its subdirectories. " "Available choices: mtime, modification, ctime, status, use, atime, access", "time", diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp index aa0f0088cc..67c7cf724a 100644 --- a/Userland/Utilities/grep.cpp +++ b/Userland/Utilities/grep.cpp @@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) args_parser.add_option(recursive, "Recursively scan files", "recursive", 'r'); args_parser.add_option(use_ere, "Extended regular expressions", "extended-regexp", 'E'); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Pattern", .long_name = "regexp", .short_name = 'e', @@ -75,7 +75,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) args_parser.add_option(quiet_mode, "Do not write anything to standard output", "quiet", 'q'); args_parser.add_option(suppress_errors, "Suppress error messages for nonexistent or unreadable files", "no-messages", 's'); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Action to take for binary files ([binary], text, skip)", .long_name = "binary-mode", .accept_value = [&](auto* str) { @@ -91,7 +91,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) }, }); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Treat binary files as text (same as --binary-mode text)", .long_name = "text", .short_name = 'a', @@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) }, }); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Ignore binary files (same as --binary-mode skip)", .long_name = nullptr, .short_name = 'I', @@ -111,7 +111,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) }, }); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "When to use colored output for the matching text ([auto], never, always)", .long_name = "color", .short_name = 0, diff --git a/Userland/Utilities/nl.cpp b/Userland/Utilities/nl.cpp index d88428cb30..5956c3972d 100644 --- a/Userland/Utilities/nl.cpp +++ b/Userland/Utilities/nl.cpp @@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::ArgsParser args_parser; Core::ArgsParser::Option number_style_option { - true, + Core::ArgsParser::OptionArgumentMode::Required, "Line numbering style: 't' for non-empty lines, 'a' for all lines, 'n' for no lines", "body-numbering", 'b', diff --git a/Userland/Utilities/pro.cpp b/Userland/Utilities/pro.cpp index 217ddffbe4..c434aa7fbb 100644 --- a/Userland/Utilities/pro.cpp +++ b/Userland/Utilities/pro.cpp @@ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(data, "(HTTP only) Send the provided data via an HTTP POST request", "data", 'd', "data"); args_parser.add_option(should_follow_url, "(HTTP only) Follow the Location header if a 3xx status is encountered", "follow", 'l'); args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Add a header entry to the request", .long_name = "header", .short_name = 'H', diff --git a/Userland/Utilities/profile.cpp b/Userland/Utilities/profile.cpp index e029da5640..5b285249e4 100644 --- a/Userland/Utilities/profile.cpp +++ b/Userland/Utilities/profile.cpp @@ -35,7 +35,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(wait, "Enable profiling and wait for user input to disable.", nullptr, 'w'); args_parser.add_option(cmd_argument, "Command", nullptr, 'c', "command"); args_parser.add_option(Core::ArgsParser::Option { - true, "Enable tracking specific event type", nullptr, 't', "event_type", + Core::ArgsParser::OptionArgumentMode::Required, + "Enable tracking specific event type", nullptr, 't', "event_type", [&](String event_type) { seen_event_type_arg = true; if (event_type == "sample") diff --git a/Userland/Utilities/run-tests.cpp b/Userland/Utilities/run-tests.cpp index aee2a25589..f2ad1b23b7 100644 --- a/Userland/Utilities/run-tests.cpp +++ b/Userland/Utilities/run-tests.cpp @@ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::ArgsParser args_parser; args_parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Show progress with OSC 9 (true, false)", .long_name = "show-progress", .short_name = 'p', diff --git a/Userland/Utilities/test-unveil.cpp b/Userland/Utilities/test-unveil.cpp index 4889d3d062..104faf47ff 100644 --- a/Userland/Utilities/test-unveil.cpp +++ b/Userland/Utilities/test-unveil.cpp @@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) parser.add_option(permissions, "Apply these permissions going forward", "permissions", 'p', "unveil-permissions"); parser.add_option(should_sleep, "Sleep after processing all arguments", "sleep", 's'); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Add a path to the unveil list", .long_name = "unveil", .short_name = 'u', @@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return true; } }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = false, + .argument_mode = Core::ArgsParser::OptionArgumentMode::None, .help_string = "Lock the veil", .long_name = "lock", .short_name = 'l', diff --git a/Userland/Utilities/top.cpp b/Userland/Utilities/top.cpp index b85616dab3..2f4d53840d 100644 --- a/Userland/Utilities/top.cpp +++ b/Userland/Utilities/top.cpp @@ -138,7 +138,7 @@ static struct winsize g_window_size; static void parse_args(Main::Arguments arguments, TopOption& top_option) { Core::ArgsParser::Option sort_by_option { - true, + Core::ArgsParser::OptionArgumentMode::Required, "Sort by field [pid, tid, pri, user, state, virt, phys, cpu, name]", "sort-by", 's', diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp index 236eba24d9..d690cb6e6f 100644 --- a/Userland/Utilities/wasm.cpp +++ b/Userland/Utilities/wasm.cpp @@ -288,7 +288,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) parser.add_option(export_all_imports, "Export noop functions corresponding to imports", "export-noop", 0); parser.add_option(shell_mode, "Launch a REPL in the module's context (implies -i)", "shell", 's'); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Extra modules to link with, use to resolve imports", .long_name = "link", .short_name = 'l', @@ -302,7 +302,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }, }); parser.add_option(Core::ArgsParser::Option { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Supply arguments to the function (default=0) (expects u64, casts to required type)", .long_name = "arg", .short_name = 0, diff --git a/Userland/Utilities/watch.cpp b/Userland/Utilities/watch.cpp index 5420f61021..5c6d178280 100644 --- a/Userland/Utilities/watch.cpp +++ b/Userland/Utilities/watch.cpp @@ -121,7 +121,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(flag_noheader, "Turn off the header describing the command and interval", "no-title", 't'); args_parser.add_option(flag_beep_on_fail, "Beep if the command has a non-zero exit code", "beep", 'b'); Core::ArgsParser::Option file_arg { - .requires_argument = true, + .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Run command whenever this file changes. Can be used multiple times.", .long_name = "file", .short_name = 'f', |