Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect:master commit in: bin/, /
Date: Tue, 28 Feb 2023 18:08:07
Message-Id: 1677607585.ed29a63568537bb2f4e341ad1415060402b4c21f.ulm@gentoo
1 commit: ed29a63568537bb2f4e341ad1415060402b4c21f
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 28 18:06:25 2023 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 28 18:06:25 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=ed29a635
7
8 Support NO_COLOR
9
10 * bin/eselect.in: Disable colours if NO_COLOR is nonempty.
11
12 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
13
14 ChangeLog | 4 ++++
15 bin/eselect.in | 3 +++
16 2 files changed, 7 insertions(+)
17
18 diff --git a/ChangeLog b/ChangeLog
19 index 64a5b5e..aab936d 100644
20 --- a/ChangeLog
21 +++ b/ChangeLog
22 @@ -1,3 +1,7 @@
23 +2023-02-28 Ulrich Müller <ulm@g.o>
24 +
25 + * bin/eselect.in: Disable colours if NO_COLOR is nonempty.
26 +
27 2023-02-27 Ulrich Müller <ulm@g.o>
28
29 * configure.ac: Update version to 1.4.21.
30
31 diff --git a/bin/eselect.in b/bin/eselect.in
32 index a521a6f..888977c 100755
33 --- a/bin/eselect.in
34 +++ b/bin/eselect.in
35 @@ -136,6 +136,7 @@ if [[ -z ${action} ]]; then
36 fi
37
38 # parse global options
39 +colour=""
40 while [[ ${1##--} != "$1" ]]; do
41 case ${1##--} in
42 brief)
43 @@ -185,6 +186,8 @@ fi
44
45 # enable colour output and get width of terminal iff stdout is a tty
46 if [[ -t 1 ]]; then
47 + # command line option overrides NO_COLOR variable
48 + [[ -z ${colour} && -n ${NO_COLOR} ]] && colour=no
49 colours ${colour:-yes}
50 init_columns
51 else