From 7720644ae2c34a97a0bbc8fe9424dee040ae46d4 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Mon, 22 Nov 2021 19:01:31 -0500 Subject: LibCore: Let ArgsParser::parse() accept Main::Arguments Instead of manually passing in `arguments.argc` and `arguments.argv`, we can now just pass in the arguments directly. --- Userland/Libraries/LibCore/ArgsParser.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Userland') diff --git a/Userland/Libraries/LibCore/ArgsParser.h b/Userland/Libraries/LibCore/ArgsParser.h index 465e155c08..538e3f9d59 100644 --- a/Userland/Libraries/LibCore/ArgsParser.h +++ b/Userland/Libraries/LibCore/ArgsParser.h @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace Core { @@ -54,6 +55,11 @@ public: }; bool parse(int argc, char* const* argv, FailureBehavior failure_behavior = FailureBehavior::PrintUsageAndExit); + bool parse(Main::Arguments const& arguments, FailureBehavior failure_behavior = FailureBehavior::PrintUsageAndExit) + { + return parse(arguments.argc, arguments.argv, failure_behavior); + } + // *Without* trailing newline! void set_general_help(const char* help_string) { m_general_help = help_string; }; void set_stop_on_first_non_option(bool stop_on_first_non_option) { m_stop_on_first_non_option = stop_on_first_non_option; } -- cgit v1.2.3