summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-11-22 19:01:31 -0500
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-11-22 21:13:42 -0800
commit7720644ae2c34a97a0bbc8fe9424dee040ae46d4 (patch)
treeb6665e0adbe6747f6b23d4e09d8f86c01bb35cf2 /Userland
parenta0ef6554516029605d743880c78e674c1546640b (diff)
downloadserenity-7720644ae2c34a97a0bbc8fe9424dee040ae46d4.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibCore/ArgsParser.h6
1 files changed, 6 insertions, 0 deletions
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 <AK/Function.h>
#include <AK/String.h>
#include <AK/Vector.h>
+#include <LibMain/Main.h>
#include <stdio.h>
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; }