aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-02-28 19:06:25 +0100
committerUlrich Müller <ulm@gentoo.org>2023-02-28 19:06:25 +0100
commited29a63568537bb2f4e341ad1415060402b4c21f (patch)
tree663650b2705a05d2bd9db16b2cd0885743028a0f
parentUpdate version to 1.4.21 (diff)
downloadeselect-ed29a63568537bb2f4e341ad1415060402b4c21f.tar.gz
eselect-ed29a63568537bb2f4e341ad1415060402b4c21f.tar.bz2
eselect-ed29a63568537bb2f4e341ad1415060402b4c21f.zip
Support NO_COLOR
* bin/eselect.in: Disable colours if NO_COLOR is nonempty. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ChangeLog4
-rwxr-xr-xbin/eselect.in3
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 64a5b5e..aab936d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-02-28 Ulrich Müller <ulm@gentoo.org>
+
+ * bin/eselect.in: Disable colours if NO_COLOR is nonempty.
+
2023-02-27 Ulrich Müller <ulm@gentoo.org>
* configure.ac: Update version to 1.4.21.
diff --git a/bin/eselect.in b/bin/eselect.in
index a521a6f..888977c 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -136,6 +136,7 @@ if [[ -z ${action} ]]; then
fi
# parse global options
+colour=""
while [[ ${1##--} != "$1" ]]; do
case ${1##--} in
brief)
@@ -185,6 +186,8 @@ fi
# enable colour output and get width of terminal iff stdout is a tty
if [[ -t 1 ]]; then
+ # command line option overrides NO_COLOR variable
+ [[ -z ${colour} && -n ${NO_COLOR} ]] && colour=no
colours ${colour:-yes}
init_columns
else