tools: gst-inspect, add option '--color' with short option '-C'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/498>
This commit is contained in:
Thor Andreassen 2020-05-19 22:54:20 +02:00 committed by GStreamer Merge Bot
parent 74d29ca771
commit 57b263d620
2 changed files with 8 additions and 1 deletions

View file

@ -61,6 +61,9 @@ Print supported URI schemes, with the elements that implement them
Disable colors in output. You can also achieve the same by setting
\'GST_INSPECT_NO_COLORS\' environment variable to any value.
.TP 8
.B \-C, \-\-color
Color output, even when not connected to a tty.
.TP 8
.B \-\-print\-plugin\-auto\-install\-info
Print a machine-parsable list of features the specified plugin provides.
Useful in connection with external automatic plugin installation mechanisms.

View file

@ -1946,6 +1946,7 @@ main (int argc, char *argv[])
gboolean print_aii = FALSE;
gboolean uri_handlers = FALSE;
gboolean check_exists = FALSE;
gboolean color_always = FALSE;
gchar *min_version = NULL;
guint minver_maj = GST_VERSION_MAJOR;
guint minver_min = GST_VERSION_MINOR;
@ -1985,6 +1986,9 @@ main (int argc, char *argv[])
("Disable colors in output. You can also achieve the same by setting"
"'GST_INSPECT_NO_COLORS' environment variable to any value."),
NULL},
{"color", 'C', 0, G_OPTION_ARG_NONE, &color_always,
N_("Color output, even when not sending to a tty."),
NULL},
GST_TOOLS_GOPTION_VERSION,
{NULL}
};
@ -2079,7 +2083,7 @@ main (int argc, char *argv[])
if (redirect_stdout ())
loop = g_main_loop_new (NULL, FALSE);
} else {
colored_output = FALSE;
colored_output = (color_always) ? TRUE : FALSE;
}
#elif defined(G_OS_WIN32)
{