If the remaining argument has an arg_description, display the synopsis as

2005-05-24  Matthias Clasen  <mclasen@redhat.com>

	* glib/goption.c (print_help): If the remaining argument
	has an arg_description, display the synopsis as
	PROGNAME [OPTION...] REST  (#305346, Noah Levitt)
This commit is contained in:
Matthias Clasen 2005-05-25 02:42:21 +00:00 committed by Matthias Clasen
parent d38febf6b3
commit 0b8e42a2f5
5 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-05-24 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (print_help): If the remaining argument
has an arg_description, display the synopsis as
PROGNAME [OPTION...] REST (#305346, Noah Levitt)
2005-05-20 Federico Mena Quintero <federico@ximian.com>
Merged from glib-2-6:

View File

@ -1,3 +1,9 @@
2005-05-24 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (print_help): If the remaining argument
has an arg_description, display the synopsis as
PROGNAME [OPTION...] REST (#305346, Noah Levitt)
2005-05-20 Federico Mena Quintero <federico@ximian.com>
Merged from glib-2-6:

View File

@ -1,3 +1,9 @@
2005-05-24 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (print_help): If the remaining argument
has an arg_description, display the synopsis as
PROGNAME [OPTION...] REST (#305346, Noah Levitt)
2005-05-20 Federico Mena Quintero <federico@ximian.com>
Merged from glib-2-6:

View File

@ -1,3 +1,9 @@
2005-05-24 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (print_help): If the remaining argument
has an arg_description, display the synopsis as
PROGNAME [OPTION...] REST (#305346, Noah Levitt)
2005-05-20 Federico Mena Quintero <federico@ximian.com>
Merged from glib-2-6:

View File

@ -437,9 +437,27 @@ print_help (GOptionContext *context,
GOptionEntry *entry;
GHashTable *shadow_map;
gboolean seen[256];
gchar *rest_description;
g_print ("%s\n %s %s %s\n\n",
rest_description = NULL;
if (context->main_group)
{
for (i = 0; i < context->main_group->n_entries; i++)
{
entry = &context->main_group->entries[i];
if (entry->long_name[0] == 0)
{
rest_description = entry->arg_description;
break;
}
}
}
g_print ("%s\n %s %s%s%s%s%s\n\n",
_("Usage:"), g_get_prgname(), _("[OPTION...]"),
rest_description ? " " : "",
rest_description ? rest_description : "",
context->parameter_string ? " " : "",
context->parameter_string ? context->parameter_string : "");
memset (seen, 0, sizeof (gboolean) * 256);