summaryrefslogtreecommitdiffstats
path: root/scripts/library/output_format.sh
diff options
context:
space:
mode:
authorWilliam Giokas <1007380@gmail.com>2013-03-04 09:08:42 +0100
committerAllan McRae <allan@archlinux.org>2013-03-08 08:04:39 +0100
commit65650f2cdb04629810cb7545e35ad8af9e25b072 (patch)
treeea1968b42fd7fcbffdfec7aecd1c08f2d18953aa /scripts/library/output_format.sh
parente292b1b5a24e8e106f1c38c7e99e494f841d9346 (diff)
downloadpacman-65650f2cdb04629810cb7545e35ad8af9e25b072.tar.gz
pacman-65650f2cdb04629810cb7545e35ad8af9e25b072.tar.xz
scripts: Add color to library/output_format.sh
Use the same colors as makepkg in messages. Add in the 'plain' function as well. To use the colors, you need to include the term_colors.sh file, or add definitions for the colors explicitly. Signed-off-by: William Giokas <1007380@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/library/output_format.sh')
-rw-r--r--scripts/library/output_format.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/library/output_format.sh b/scripts/library/output_format.sh
index 9e890e76..18f1f588 100644
--- a/scripts/library/output_format.sh
+++ b/scripts/library/output_format.sh
@@ -1,21 +1,27 @@
+plain() {
+ (( QUIET )) && return
+ local mesg=$1; shift
+ printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
+}
+
msg() {
(( QUIET )) && return
local mesg=$1; shift
- printf "==> ${mesg}\n" "$@" >&1
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
}
msg2() {
(( QUIET )) && return
local mesg=$1; shift
- printf " -> ${mesg}\n" "$@" >&1
+ printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
}
warning() {
local mesg=$1; shift
- printf "==> $(gettext "WARNING:") ${mesg}\n" "$@" >&2
+ printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
error() {
local mesg=$1; shift
- printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
-} \ No newline at end of file
+ printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}