mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-27 18:10:03 +01:00
gio-tool: Print help output to stdout when --help is passed
If the help output is explicitly requested by the user, it’s conventional for it to be printed to stdout rather than stderr. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
This commit is contained in:
parent
7c97b93837
commit
96ee1ea086
@ -249,7 +249,7 @@ static const struct
|
||||
};
|
||||
|
||||
static void
|
||||
usage (void)
|
||||
usage (gboolean is_error)
|
||||
{
|
||||
GString *out = NULL;
|
||||
size_t name_width = 0;
|
||||
@ -274,7 +274,10 @@ usage (void)
|
||||
g_string_append_c (out, '\n');
|
||||
g_string_append_printf (out, _("Use %s to get detailed help.\n"), "“gio help COMMAND”");
|
||||
|
||||
g_printerr ("%s", out->str);
|
||||
if (is_error)
|
||||
g_printerr ("%s", out->str);
|
||||
else
|
||||
g_print ("%s", out->str);
|
||||
|
||||
g_string_free (out, TRUE);
|
||||
}
|
||||
@ -306,7 +309,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
usage ();
|
||||
usage (TRUE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -319,7 +322,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
usage ();
|
||||
usage (FALSE);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -330,7 +333,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
else if (g_str_equal (command, "--help"))
|
||||
{
|
||||
usage ();
|
||||
usage (FALSE);
|
||||
return 0;
|
||||
}
|
||||
else if (g_str_equal (command, "--version"))
|
||||
@ -347,7 +350,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Unknown subcommand. */
|
||||
usage ();
|
||||
usage (TRUE);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user