commit: ed29a63568537bb2f4e341ad1415060402b4c21f Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Tue Feb 28 18:06:25 2023 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Tue Feb 28 18:06:25 2023 +0000 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=ed29a635
Support NO_COLOR * bin/eselect.in: Disable colours if NO_COLOR is nonempty. Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> ChangeLog | 4 ++++ bin/eselect.in | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 64a5b5e..aab936d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2023-02-28 Ulrich Müller <u...@gentoo.org> + + * bin/eselect.in: Disable colours if NO_COLOR is nonempty. + 2023-02-27 Ulrich Müller <u...@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