mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-28 21:09:54 +01:00
Add G_OPTION_FLAG_APPEND_EMPTY_LINE
This flag adds in --help output an empty line after the line of the option, allowing to visually group options.
This commit is contained in:
@@ -729,9 +729,14 @@ print_entry (GOptionGroup *group,
|
||||
if (entry->arg_description)
|
||||
g_string_append_printf (str, "=%s", TRANSLATE (group, entry->arg_description));
|
||||
|
||||
g_string_append_printf (string, "%s%*s %s\n", str->str,
|
||||
(int) (max_length + 4 - _g_utf8_strwidth (str->str)), "",
|
||||
entry->description ? TRANSLATE (group, entry->description) : "");
|
||||
if (entry->flags & G_OPTION_FLAG_APPEND_EMPTY_LINE)
|
||||
g_string_append_printf (string, "%s%*s %s\n\n", str->str,
|
||||
(int) (max_length + 4 - _g_utf8_strwidth (str->str)), "",
|
||||
entry->description ? TRANSLATE (group, entry->description) : "");
|
||||
else
|
||||
g_string_append_printf (string, "%s%*s %s\n", str->str,
|
||||
(int) (max_length + 4 - _g_utf8_strwidth (str->str)), "",
|
||||
entry->description ? TRANSLATE (group, entry->description) : "");
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ typedef struct _GOptionEntry GOptionEntry;
|
||||
* where aliasing is necessary to model some legacy commandline interface.
|
||||
* It is not safe to use this option, unless all option groups are under
|
||||
* your direct control. Since 2.8.
|
||||
* @G_OPTION_FLAG_APPEND_EMPTY_LINE: This flag adds an empty line after the
|
||||
* one of the option, allowing to visually group options. Since: 2.63.1.
|
||||
*
|
||||
* Flags which modify individual options.
|
||||
*/
|
||||
@@ -87,7 +89,8 @@ typedef enum
|
||||
G_OPTION_FLAG_NO_ARG = 1 << 3,
|
||||
G_OPTION_FLAG_FILENAME = 1 << 4,
|
||||
G_OPTION_FLAG_OPTIONAL_ARG = 1 << 5,
|
||||
G_OPTION_FLAG_NOALIAS = 1 << 6
|
||||
G_OPTION_FLAG_NOALIAS = 1 << 6,
|
||||
G_OPTION_FLAG_APPEND_EMPTY_LINE = 1 << 7
|
||||
} GOptionFlags;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user