mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
ArgsParser: Remove boolean trap on add_arg
Rather than requiring a boolean for whether or not the argument is required, add some new methods to make the purpose of the bool explicit.
This commit is contained in:
parent
5cad215919
commit
729507f2bd
3 changed files with 22 additions and 10 deletions
|
@ -115,14 +115,24 @@ bool ArgsParser::check_required_args(const ArgsParserResult& res)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ArgsParser::add_arg(const String& name, const String& description, bool required)
|
||||
void ArgsParser::add_required_arg(const String& name, const String& description)
|
||||
{
|
||||
m_args.set(name, Arg(name, description, required));
|
||||
m_args.set(name, Arg(name, description, true));
|
||||
}
|
||||
|
||||
void ArgsParser::add_arg(const String& name, const String& value_name, const String& description, bool required)
|
||||
void ArgsParser::add_required_arg(const String& name, const String& value_name, const String& description)
|
||||
{
|
||||
m_args.set(name, Arg(name, value_name, description, required));
|
||||
m_args.set(name, Arg(name, value_name, description, true));
|
||||
}
|
||||
|
||||
void ArgsParser::add_arg(const String& name, const String& description)
|
||||
{
|
||||
m_args.set(name, Arg(name, description, false));
|
||||
}
|
||||
|
||||
void ArgsParser::add_arg(const String& name, const String& value_name, const String& description)
|
||||
{
|
||||
m_args.set(name, Arg(name, value_name, description, false));
|
||||
}
|
||||
|
||||
String ArgsParser::get_usage() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue