mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 20:40:34 +01:00
cli: honor NO_COLOR environment variable to prevent automatic ASCII colors
See-also: https://no-color.org/
This commit is contained in:
parent
d0db41c1d4
commit
597e4b2d1e
2 changed files with 9 additions and 0 deletions
|
|
@ -456,6 +456,12 @@ check_colors (NmcColorOption color_option,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ( color_option == NMC_USE_COLOR_AUTO
|
||||
&& g_getenv ("NO_COLOR")) {
|
||||
/* https://no-color.org/ */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
term = g_getenv ("TERM");
|
||||
|
||||
if (color_option == NMC_USE_COLOR_AUTO) {
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@
|
|||
<citerefentry><refentrytitle>terminal-colors.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
||||
Please refer to the <link linkend='colors' endterm='colors.title' /> section for a
|
||||
list of color names supported by <command>nmcli</command>.</para>
|
||||
<para>If the environment variable <literal>NO_COLOR</literal> is set (to any value),
|
||||
then coloring is disabled with mode "auto". Explicitly enabling coloring overrides
|
||||
the environment variable.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue