GOptionContext group headings missing colon at the end
Hi,
currently, the --help-all
output of programs using GOptionContext will print headings like Help Options:
and Application Options:
but all other group headings are missing the trailing colon. For example, here is the output of totem --help-all
:
Usage:
totem [OPTION…]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gapplication Show GApplication options
--help-gtk Show GTK+ Options
--help-gst Show GStreamer Options
GApplication options
--gapplication-service Enter GApplication service mode (use from D-Bus service files)
GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal
GStreamer Options
--gst-version Print the GStreamer version
--gst-fatal-warnings Make all warnings fatal
--gst-debug-help Print available debug categories and exit
--gst-debug-level=LEVEL Default debug level from 1 (only error) to 9 (anything) or 0 for no output
--gst-debug=LIST Comma-separated list of category_name:level pairs to set specific levels for the individual categories. Example: GST_AUTOPLUG:5,GST_ELEMENT_*:3
--gst-debug-no-color Disable colored debugging output
--gst-debug-color-mode Changes coloring mode of the debug log. Possible modes: off, on, disable, auto, unix
--gst-debug-disable Disable debugging
--gst-plugin-spew Enable verbose plugin loading diagnostics
--gst-plugin-path=PATHS Colon-separated paths containing plugins
--gst-plugin-load=PLUGINS Comma-separated list of plugins to preload in addition to the list stored in environment variable GST_PLUGIN_PATH
--gst-disable-segtrap Disable trapping of segmentation faults during plugin loading
--gst-disable-registry-update Disable updating the registry
--gst-disable-registry-fork Disable spawning a helper process while scanning the registry
Application Options:
--play-pause Play/Pause
--play Play
--pause Pause
--next Next
--previous Previous
--seek-fwd Seek Forwards
--seek-bwd Seek Backwards
--volume-up Volume Up
--volume-down Volume Down
--mute Mute sound
--fullscreen Toggle Fullscreen
--quit Quit
--enqueue Enqueue
--replace Replace
--version Show version information and exit
--display=DISPLAY X display to use
This is an issue because:
- consistency: either let all headings have a colon at the end or none
- help2man output will use the trailing colon to create section headings in the man pages it creates. Without the trailing colon, help2man output will be suboptimal as what is supposed to be a heading is treated as normal text.
The following patch fixes the problem:
--- a/glib/goption.c
+++ b/glib/goption.c
@@ -1019,7 +1019,7 @@ g_option_context_get_help (GOptionContex
if (group_has_visible_entries (context, group, FALSE))
{
g_string_append (string, TRANSLATE (group, group->description));
- g_string_append (string, "\n");
+ g_string_append (string, ":\n");
for (i = 0; i < group->n_entries; i++)
print_entry (group, max_length, &group->entries[i], string, aliases);
g_string_append (string, "\n");
@@ -1038,7 +1038,7 @@ g_option_context_get_help (GOptionContex
if (group_has_visible_entries (context, g, FALSE))
{
g_string_append (string, g->description);
- g_string_append (string, "\n");
+ g_string_append (string, ":\n");
for (i = 0; i < g->n_entries; i++)
if (!(g->entries[i].flags & G_OPTION_FLAG_IN_MAIN))
print_entry (g, max_length, &g->entries[i], string, aliases);