commit:     94446b64cc9f9a912184a85fa43070fecbc4ce0f
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jun 12 12:51:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 23 21:19:15 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=94446b64

Deprecate RC_NOCOLOR and the equivalent use of the positional parameters

Firstly, the "." builtin is not specified to support the passing of
arguments; such is a bashism. It is rather presumptuous to act as if the
present contents of the positional parameters are for the benefit of
gentoo-functions at the time of its initialisation.

Secondly, there exists a de-facto standard for suppressing colored
output, which is to define NO_COLOR as a non-empty string, per
https://no-color.org.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 functions/rc.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/functions/rc.sh b/functions/rc.sh
index 519d847..2f2dc52 100644
--- a/functions/rc.sh
+++ b/functions/rc.sh
@@ -422,13 +422,16 @@ _is_visible()
 
#------------------------------------------------------------------------------#
 
 # Determine whether the use of color is to be wilfully avoided.
-if [ -n "${NO_COLOR}" ]; then
+if [ "${RC_NOCOLOR+set}" ]; then
+       warn "the RC_NOCOLOR variable is deprecated by gentoo-functions; please 
set NO_COLOR instead"
+elif [ -n "${NO_COLOR}" ]; then
        # See https://no-color.org/.
        RC_NOCOLOR=yes
 else
        for _; do
                case $_ in
                        --nocolor|--nocolour|-C)
+                               warn "the $_ option is deprecated by 
gentoo-functions; please set NO_COLOR=1 instead"
                                RC_NOCOLOR=yes
                                break
                esac

Reply via email to