[pacman-dev] [PATCH] makepkg: use tput for terminal-safe colored and bold text
Cedric Staniewski
cedric at gmx.ca
Fri Oct 23 09:11:41 EDT 2009
Suggested-by: Dan McGee <dan at archlinux.org>
Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---
scripts/makepkg.sh.in | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2a3d22d..f7d1fc8 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -28,7 +28,7 @@
# makepkg uses quite a few external programs during its execution. You
# need to have at least the following installed for makepkg to function:
# bsdtar (libarchive), bzip2, coreutils, fakeroot, find (findutils),
-# getopt (util-linux), gettext, grep, gzip, openssl, sed
+# getopt (util-linux), gettext, grep, gzip, openssl, sed, tput (ncurses)
# gettext initialization
export TEXTDOMAIN='pacman'
@@ -1555,13 +1555,13 @@ fi
# check if messages are to be printed using color
if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
- readonly ALL_OFF="\033[1;0m" \
- BOLD="\033[1;1m"
+ readonly ALL_OFF="$(tput sgr0)" \
+ BOLD="$(tput bold)"
readonly ALL_OFF_BOLD="${ALL_OFF}${BOLD}" \
- RED="${BOLD}\033[1;31m" \
- BLUE="${BOLD}\033[1;34m" \
- GREEN="${BOLD}\033[1;32m" \
- YELLOW="${BOLD}\033[1;33m"
+ RED="${BOLD}$(tput setaf 1)" \
+ BLUE="${BOLD}$(tput setaf 4)" \
+ GREEN="${BOLD}$(tput setaf 2)" \
+ YELLOW="${BOLD}$(tput setaf 3)"
else
unset ALL_OFF ALL_OFF_BOLD BOLD RED BLUE GREEN YELLOW
readonly ALL_OFF ALL_OFF_BOLD BOLD RED BLUE GREEN YELLOW
--
1.6.5.1
More information about the pacman-dev
mailing list