Commit 56b4fbef5e refactored the pipe code
to use GLib utility, but the patch was hading some other changed. LESS
env was now hardcoded in the middle instead of from a define and was
changed from FXR to -RX. The "-" is not even valid for LESS env, and
with the lost of F, we would still use a pager when the content fits the
terminal.
Setup it only if we have something to print out about inspected results.
Otherwise, gst_tools_print_version() output will be redirected to pager and also
exit immediately without waiting child process.
Not only this will make colored output work on old terminals and console
as well, terminals can theme the actual colors this way to make it fit
with their different themes this way.
Let's make the output a bit pretty to read. The colored output can be
disabled with `--no-colors` option or by setting `GST_INSPECT_NO_COLORS'
env (to any value).
The chosen colors are based on the popular Solarized theme, which is
targeted for both dark and light backgrounds.
Note:
* We only support true colors. If the terminal doesn't signal support for
that via 'COLORTERM' env, we disable colored output.
* We don't add colors to --print-plugin-auto-install-info output, as
that's meant for machines, not humans. Not only machines don't care
about beauty, the existing ones will likely not expect colors and choke
on it and we'll get angry mob at our doors.
[1] https://ethanschoonover.com/solarized
When printing info about a specific plugin, there is no need to prefix
some of the details with plugin's name. It's not only redundant but also
inconsistent and makes the task of adding consistent coloring to the
output (which we'll do in a follow patch), harder.
This emulates the default behaviour of git help pages, and also fixes
a bug on macOS where `less -F` doesn't display anything at all when
the output is shorter than one terminal screen.
Also moved the DEFAULT_PAGER define to after the includes, because
it's an unprefixed define.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/330
Rename print_element_features() to print_feature_info() and move the code that
handles the ElementFactory there. This simplifies the calling code and improves
readability.
Also don't leak the features for other factories.
Don't use templates for the man pages, the API version change is a rare
event, so it's not really worth keeping in place the "sed" boilerplate
to have it set at build time.
Shipping the final man pages directly also makes it easer to install the
man pages with meson (in a future commit).
Note that now all the occurrences of the programs names have the API
version as a suffix.
Traditionally the example command lines looked like:
gst-launch ...
Now they look like:
gst-launch-1.0 ...
This reflects the actual programs names and makes it easier to copy and
paste the example commands.
Also, the .gitignore file is adjusted not to ignore the final man pages
anymore.
You may need to clean your src/build directory before pulling in this
patch.
https://bugzilla.gnome.org/show_bug.cgi?id=773917