mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibCore/ArgsParser: Learn how to stop on first non-option
We need this for utilities like `env`, that do not gain anything by parsing the options passed to the command they are supposed to execute.
This commit is contained in:
parent
0b0bce78f6
commit
d7126fbbc2
3 changed files with 181 additions and 0 deletions
|
@ -56,6 +56,7 @@ public:
|
|||
bool parse(int argc, char* const* argv, FailureBehavior failure_behavior = FailureBehavior::PrintUsageAndExit);
|
||||
// *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; }
|
||||
void print_usage(FILE*, const char* argv0);
|
||||
|
||||
void add_option(Option&&);
|
||||
|
@ -81,6 +82,7 @@ private:
|
|||
|
||||
bool m_show_help { false };
|
||||
const char* m_general_help { nullptr };
|
||||
bool m_stop_on_first_non_option { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue