diff options
author | Christian Faulhammer <opfer@gentoo.org> | 2007-11-30 07:06:02 +0000 |
---|---|---|
committer | Christian Faulhammer <opfer@gentoo.org> | 2007-11-30 07:06:02 +0000 |
commit | 4de568ec8a5a2b5f6b62b279e1ec74117d1ce981 (patch) | |
tree | 4aaf5a99f47e6f725a936453c663edf38a144a81 | |
parent | ChangeLog (diff) | |
download | emacs-tools-4de568ec8a5a2b5f6b62b279e1ec74117d1ce981.tar.gz emacs-tools-4de568ec8a5a2b5f6b62b279e1ec74117d1ce981.tar.bz2 emacs-tools-4de568ec8a5a2b5f6b62b279e1ec74117d1ce981.zip |
Only set colours if output is not redirected, proposed by ulm
Remove empty line display in message(), warning() and failure() for optical reasons
Format output with some more empty lines
Add URL for Emacs Project homepage to header
svn path=/emacs-extra/eselect-emacs/; revision=813
-rwxr-xr-x | emacs-updater.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/emacs-updater.sh b/emacs-updater.sh index 2c134b9..4249111 100755 --- a/emacs-updater.sh +++ b/emacs-updater.sh @@ -3,13 +3,16 @@ # Licensed under GPL version 2 # Author Christian Faulhammer <opfer@gentoo.org> -BLUE=$'\033[34;01m' -GREEN=$'\e[32;01m' -RED=$'\033[31;01m' -YELLOW=$'\033[33;01m' -CYAN=$'\033[36;01m' -BOLD=$'\e[0;01m' -NORMAL=$'\033[0m' +# Only set colours if output is not redirected +if tty -s <&1; then + BLUE=$'\033[34;01m' + GREEN=$'\e[32;01m' + RED=$'\033[31;01m' + YELLOW=$'\033[33;01m' + CYAN=$'\033[36;01m' + BOLD=$'\e[0;01m' + NORMAL=$'\033[0m' +fi SITELISP=/usr/share/emacs/site-lisp VERSION=0.2 @@ -18,29 +21,29 @@ TMPFILE="$(mktemp /tmp/emacs-updater.XXXXXX)" message() { local OUTPUT=$@ - echo echo "${GREEN}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}" } warning() { local OUTPUT=$@ - echo echo "${YELLOW}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}" } failure() { local OUTPUT=$@ - echo echo "${RED}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}" } echo echo "Emacs updater version ${VERSION}" -echo "Written by the Gentoo Emacs team" +echo "Written by the Gentoo Emacs team http://www.gentoo.org/proj/en/lisp/emacs/" echo "Find packages that are installed in the wrong location, file bugs on http://bugs.gentoo.org/" +echo warning "Note, you must use the eclasses from the Emacs Overlay for proper operation! " +echo if ! [ -x /usr/bin/qfile ]; then + echo failure "Please emerge app-portage/portage-utils to use this tool" exit 1 fi @@ -50,7 +53,7 @@ do message "Processing ..." qfile -qC "${sf}" >> "${TMPFILE}" done - +echo if [[ $(cat ${TMPFILE}) == "" ]]; then warning "No packages to update, quitting." |