mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibCore: Add ArgsParser::add_option(String&)
The API existed for add_positional_argument, but not for named arguments.
This commit is contained in:
parent
8e44a0bd46
commit
b30f5dc8b5
Notes:
sideshowbarker
2024-07-18 19:25:09 +09:00
Author: https://github.com/Dexesttp Commit: https://github.com/SerenityOS/serenity/commit/b30f5dc8b5c Pull-request: https://github.com/SerenityOS/serenity/pull/6420 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg ✅
2 changed files with 17 additions and 0 deletions
|
@ -288,6 +288,22 @@ void ArgsParser::add_option(const char*& value, const char* help_string, const c
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(String& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
help_string,
|
||||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
value = s;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
|
||||
{
|
||||
Option option {
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
void add_option(Option&&);
|
||||
void add_option(bool& value, const char* help_string, const char* long_name, char short_name);
|
||||
void add_option(const char*& value, const char* help_string, const char* long_name, char short_name, const char* value_name);
|
||||
void add_option(String& value, const char* help_string, const char* long_name, char short_name, const char* value_name);
|
||||
void add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name);
|
||||
void add_option(double& value, const char* help_string, const char* long_name, char short_name, const char* value_name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue