summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-06-12 13:51:55 +0100
committerKerin Millar <kfm@plushkava.net>2024-06-23 22:19:15 +0100
commit94446b64cc9f9a912184a85fa43070fecbc4ce0f (patch)
tree2749281f51e3cc33d629843de509737edb0842d8
parentRender gentoo-functions modular in nature (diff)
downloadgentoo-functions-94446b64cc9f9a912184a85fa43070fecbc4ce0f.tar.gz
gentoo-functions-94446b64cc9f9a912184a85fa43070fecbc4ce0f.tar.bz2
gentoo-functions-94446b64cc9f9a912184a85fa43070fecbc4ce0f.zip
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@plushkava.net>
-rw-r--r--functions/rc.sh5
1 files changed, 4 insertions, 1 deletions
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