Everywhere: Use ArgsParser::parse() with Main::Arguments directly
Use the updated API everywhere we are currently manually passing in `arguments.argc` and `arguments.argv`.
This commit is contained in:
parent
7720644ae2
commit
2fbcab46bf
Notes:
sideshowbarker
2024-07-18 00:50:12 +09:00
Author: https://github.com/mustafaquraish Commit: https://github.com/SerenityOS/serenity/commit/2fbcab46bfe Pull-request: https://github.com/SerenityOS/serenity/pull/11027
8 changed files with 8 additions and 8 deletions
|
@ -196,7 +196,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(cpu, "Create CPU graph", "cpu", 'C', "cpu");
|
||||
args_parser.add_option(memory, "Create memory graph", "memory", 'M', "memory");
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (!cpu && !memory) {
|
||||
printf("At least one of --cpu or --memory must be used");
|
||||
|
|
|
@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(specified_url, "URL to open", "url", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(is_selection_mode, "Show entry in parent folder", "select", 's');
|
||||
args_parser.add_option(ignore_path_resolution, "Use raw path, do not resolve real path", "raw", 'r');
|
||||
args_parser.add_positional_argument(initial_location, "Path to open", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
const char* image_file = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
TRY(System::unveil("/res", "r"));
|
||||
TRY(System::unveil("/tmp/portal/clipboard", "rw"));
|
||||
|
|
|
@ -274,7 +274,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(command_to_execute, "Execute this command inside the terminal", nullptr, 'e', "command");
|
||||
args_parser.add_option(keep_open, "Keep the terminal open after the command has finished executing", nullptr, 'k');
|
||||
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (keep_open && !command_to_execute) {
|
||||
warnln("Option -k can only be used in combination with -e.");
|
||||
|
|
|
@ -160,7 +160,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(star_count, "Number of stars to draw (default = 1000)", "stars", 'c', "number");
|
||||
args_parser.add_option(refresh_rate, "Refresh rate (default = 16)", "rate", 'r', "milliseconds");
|
||||
args_parser.add_option(speed, "Speed (default = 1)", "speed", 's', "number");
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(flag_print_gid_all, "Print all GIDs", nullptr, 'G');
|
||||
args_parser.add_option(flag_print_name, "Print name", nullptr, 'n');
|
||||
args_parser.add_positional_argument(user_str, "User name/UID to query", "USER", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (flag_print_name && !(flag_print_uid || flag_print_gid || flag_print_gid_all)) {
|
||||
warnln("cannot print only names or real IDs in default format");
|
||||
|
|
|
@ -1129,7 +1129,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
#endif
|
||||
args_parser.add_option(disable_syntax_highlight, "Disable live syntax highlighting", "no-syntax-highlight", 's');
|
||||
args_parser.add_positional_argument(script_paths, "Path to script files", "scripts", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments.argc, arguments.argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
bool syntax_highlight = !disable_syntax_highlight;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue