1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibCore: Make ArgParser::Arg::accept_value return ErrorOr<bool>

Much like the previous commit, this commit makes the
ArgParser::Arg::accept_value callback return an ErrorOr<bool> instead of
just a bool.

The aim of this is to make argument parsing more robust, especially
with the newer String api that returns an ErrorOr for many functions.
This commit is contained in:
Carwyn Nelson 2023-07-01 16:08:46 +01:00 committed by Ali Mohammad Pur
parent abbfb00a02
commit a2591bc5fa
2 changed files with 12 additions and 16 deletions

View file

@ -67,7 +67,7 @@ public:
char const* name { nullptr };
int min_values { 0 };
int max_values { 1 };
Function<bool(StringView)> accept_value;
Function<ErrorOr<bool>(StringView)> accept_value;
};
bool parse(Span<StringView> arguments, FailureBehavior failure_behavior = FailureBehavior::PrintUsageAndExit);