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.
This commit is contained in:
Mustafa Quraish 2021-11-22 19:01:31 -05:00 committed by Brian Gianforcaro
parent a0ef655451
commit 7720644ae2
Notes: sideshowbarker 2024-07-18 00:50:16 +09:00

View File

@ -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; }