mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-24 19:07:52 +02:00
GOptionContext: Improve help in simple cases
Only add [OPTION...] to the usage line if the context has options. And shorten "Application Options" to just "Options" if we don't have to differentiate from other kinds of options.
This commit is contained in:
@@ -854,8 +854,11 @@ g_option_context_get_help (GOptionContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append_printf (string, "%s\n %s %s",
|
||||
_("Usage:"), g_get_prgname(), _("[OPTION...]"));
|
||||
g_string_append_printf (string, "%s\n %s", _("Usage:"), g_get_prgname());
|
||||
if (context->help_enabled ||
|
||||
context->main_group->n_entries > 0 ||
|
||||
context->groups != NULL)
|
||||
g_string_append_printf (string, " %s", _("[OPTION...]"));
|
||||
|
||||
if (rest_description)
|
||||
{
|
||||
@@ -1040,7 +1043,10 @@ g_option_context_get_help (GOptionContext *context,
|
||||
{
|
||||
list = context->groups;
|
||||
|
||||
g_string_append (string, _("Application Options:"));
|
||||
if (context->help_enabled || list)
|
||||
g_string_append (string, _("Application Options:"));
|
||||
else
|
||||
g_string_append (string, _("Options:"));
|
||||
g_string_append (string, "\n");
|
||||
if (context->main_group)
|
||||
for (i = 0; i < context->main_group->n_entries; i++)
|
||||
|
Reference in New Issue
Block a user