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 /Userland/Utilities/grep.cpp | |
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.
Diffstat (limited to 'Userland/Utilities/grep.cpp')
-rw-r--r-- | Userland/Utilities/grep.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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, |