aboutsummaryrefslogtreecommitdiff
path: root/bin
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 /bin
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>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/eselect.in3
1 files changed, 3 insertions, 0 deletions
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