From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect:master commit in: libs/, /, bin/
Date: Fri, 25 Oct 2013 16:32:59 +0000 (UTC) [thread overview]
Message-ID: <1382718497.a530e411f0cc50cf9598985fb03cf40ff85c69d7.ulm@gentoo> (raw)
commit: a530e411f0cc50cf9598985fb03cf40ff85c69d7
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 25 16:28:17 2013 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Oct 25 16:28:17 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=a530e411
Function 'colours' accepts an argument. Remove 'nocolours'.
* libs/output.bash.in (colours): Accept an argument and handle
both enabling and disabling of colour output.
(nocolours): Remove function.
* bin/eselect.in: Call 'colours' with appropriate argument.
---
ChangeLog | 7 +++++++
bin/eselect.in | 4 ++--
libs/output.bash.in | 41 ++++++++++++++++++++---------------------
3 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f06969f..59a9ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-25 Ulrich Müller <ulm@gentoo.org>
+
+ * libs/output.bash.in (colours): Accept an argument and handle
+ both enabling and disabling of colour output.
+ (nocolours): Remove function.
+ * bin/eselect.in: Call 'colours' with appropriate argument.
+
2013-10-22 Ulrich Müller <ulm@gentoo.org>
* bin/eselect.in (es_do_list_options, es_do_list_modules):
diff --git a/bin/eselect.in b/bin/eselect.in
index fd570df..b3b7c9e 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -159,10 +159,10 @@ fi
# enable colour output and get width of terminal iff stdout is a tty
if [[ -t 1 ]]; then
- if [[ ${colour} = no ]]; then nocolours; else colours; fi
+ colours ${colour:-yes}
init_columns
else
- if [[ ${colour} = yes ]]; then colours; else nocolours; fi
+ colours ${colour:-no}
fi
unset colour
diff --git a/libs/output.bash.in b/libs/output.bash.in
index bf29721..5c79c53 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -15,28 +15,27 @@
# You should have received a copy of the GNU General Public License along with
# eselect. If not, see <http://www.gnu.org/licenses/>.
-# Colours
colours() {
- COLOUR_NORMAL=$(tput sgr0)
- COLOUR_BOLD=$(tput bold)
- COLOUR_HI=$(tput setaf 4)${COLOUR_BOLD} # blue
- COLOUR_WARN=$(tput setaf 1)${COLOUR_BOLD} # red
- COLOUR_ERROR=${COLOUR_WARN}
- COLOUR_LIST_HEADER=$(tput setaf 2)${COLOUR_BOLD} # green
- COLOUR_LIST_LEFT=${COLOUR_BOLD}
- COLOUR_LIST_RIGHT=${COLOUR_NORMAL}
-}
-
-# disable all colours
-nocolours() {
- COLOUR_NORMAL=""
- COLOUR_BOLD=""
- COLOUR_HI=""
- COLOUR_WARN=""
- COLOUR_ERROR=""
- COLOUR_LIST_HEADER=""
- COLOUR_LIST_LEFT=""
- COLOUR_LIST_RIGHT=""
+ if [[ $1 != n* ]]; then
+ COLOUR_NORMAL=$(tput sgr0)
+ COLOUR_BOLD=$(tput bold)
+ COLOUR_HI=$(tput setaf 4)${COLOUR_BOLD} # blue
+ COLOUR_WARN=$(tput setaf 1)${COLOUR_BOLD} # red
+ COLOUR_ERROR=${COLOUR_WARN}
+ COLOUR_LIST_HEADER=$(tput setaf 2)${COLOUR_BOLD} # green
+ COLOUR_LIST_LEFT=${COLOUR_BOLD}
+ COLOUR_LIST_RIGHT=${COLOUR_NORMAL}
+ else
+ # disable all colours
+ COLOUR_NORMAL=""
+ COLOUR_BOLD=""
+ COLOUR_HI=""
+ COLOUR_WARN=""
+ COLOUR_ERROR=""
+ COLOUR_LIST_HEADER=""
+ COLOUR_LIST_LEFT=""
+ COLOUR_LIST_RIGHT=""
+ fi
}
# set output mode to $1
next reply other threads:[~2013-10-25 16:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-25 16:32 Ulrich Müller [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-10-22 8:19 [gentoo-commits] proj/eselect:master commit in: libs/, /, bin/ Ulrich Müller
2013-07-06 13:06 Ulrich Mueller
2013-01-13 13:10 Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382718497.a530e411f0cc50cf9598985fb03cf40ff85c69d7.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox