mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
LibCore: Offer to display a general description
This commit is contained in:
parent
886b43e999
commit
52a8062084
Notes:
sideshowbarker
2024-07-19 01:02:24 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/52a80620847 Pull-request: https://github.com/SerenityOS/serenity/pull/4332
@ -206,6 +206,11 @@ void ArgsParser::print_usage(FILE* file, const char* argv0)
|
||||
}
|
||||
outln(file);
|
||||
|
||||
if (m_general_help != nullptr && m_general_help[0] != '\0') {
|
||||
outln(file, "\nDescription:");
|
||||
outln(file, m_general_help);
|
||||
}
|
||||
|
||||
if (!m_options.is_empty())
|
||||
outln(file, "\nOptions:");
|
||||
for (auto& opt : m_options) {
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
};
|
||||
|
||||
bool parse(int argc, char** argv, bool exit_on_failure = true);
|
||||
// *Without* trailing newline!
|
||||
void set_general_help(const char* help_string) { m_general_help = help_string; };
|
||||
void print_usage(FILE*, const char* argv0);
|
||||
|
||||
void add_option(Option&&);
|
||||
@ -86,6 +88,7 @@ private:
|
||||
Vector<Arg> m_positional_args;
|
||||
|
||||
bool m_show_help { false };
|
||||
const char* m_general_help { nullptr };
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user