mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01: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:
parent
525bbbd6bd
commit
126c685f4a
@ -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++)
|
||||
|
Loading…
Reference in New Issue
Block a user