diff options
author | Linux User <ncopa@buildozer.(none)> | 2008-11-08 11:05:45 +0000 |
---|---|---|
committer | Linux User <ncopa@buildozer.(none)> | 2008-11-08 11:05:45 +0000 |
commit | d9f5462b347b3d094abea9a73d2f302d3a55e9ec (patch) | |
tree | da61b0084fb2b197a7564db3d95f5a958059f808 /abuild | |
parent | e4a3c05d8350f2d6f7d314f5acf20b420871f590 (diff) | |
download | abuild-d9f5462b347b3d094abea9a73d2f302d3a55e9ec.tar.gz abuild-d9f5462b347b3d094abea9a73d2f302d3a55e9ec.tar.bz2 abuild-d9f5462b347b3d094abea9a73d2f302d3a55e9ec.tar.xz abuild-d9f5462b347b3d094abea9a73d2f302d3a55e9ec.zip |
use colors on messages
Diffstat (limited to 'abuild')
-rwxr-xr-x | abuild | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -25,20 +25,41 @@ PKGDEST=${PKGDEST:-$startdir} default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg" +#colors +if [ -n "$USE_COLORS" ]; then + NORMAL="\033[1;0m" + STRONG="\033[1;1m" + RED="\033[1;31m" + GREEN="\033[1;32m" + YELLOW="\033[1;33m" + BLUE="\033[1;34m" +fi + + # functions msg() { - local fake="${FAKEROOTKEY:+(fakeroot) }" - local name="${subpkgname:-$pkgname}" - [ -z "$quiet" ] && echo ">>> ${fake}${name}:" "$@" >&2 + local prompt="$GREEN>>>${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + [ -z "$quiet" ] && printf "${prompt} ${fake}${name}: $@\n" >&2 } warning() { - echo ">>> Warning:" "$@" >&2 + local prompt="${YELLOW}>>> WARNING: ${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + printf "${prompt} ${fake}${name}: $@\n" >&2 +} + +error() { + local prompt="${RED}>>> ERROR: ${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + printf "${prompt} ${fake}${name}: $@\n" >&2 } die() { - quiet= - msg "$@" >&2 + error "$@" exit 1 } |