From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3EE1E198003 for ; Sat, 9 Mar 2013 12:31:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C192AE078D; Sat, 9 Mar 2013 12:31:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4B4A0E078D for ; Sat, 9 Mar 2013 12:31:13 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 351C633DBA4 for ; Sat, 9 Mar 2013 12:31:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 99437E42C6 for ; Sat, 9 Mar 2013 12:31:09 +0000 (UTC) From: "Ulrich Mueller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" Message-ID: <1362832494.c42f31849a70163a7364ed92eca5a2577f7010af.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:emacs-updater commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: ChangeLog emacs-updater emacs-updater.8 X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Mueller X-VCS-Revision: c42f31849a70163a7364ed92eca5a2577f7010af X-VCS-Branch: emacs-updater Date: Sat, 9 Mar 2013 12:31:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2a1bcfc3-9941-4a83-906b-9ff6843eb382 X-Archives-Hash: ed8b140f022cb30231f0899f9b40c1ff commit: c42f31849a70163a7364ed92eca5a2577f7010af Author: Ulrich Müller gentoo org> AuthorDate: Sat Mar 9 12:32:31 2013 +0000 Commit: Ulrich Mueller gentoo org> CommitDate: Sat Mar 9 12:34:54 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=c42f3184 New --colour option. * emacs-updater (OPTIONS): New long option --colour=, compatible with the same option in eselect. Spelling --color is recognised too. (COLOUR): Variable renamed from NOCOLOUR. (usage): Update help text. * emacs-updater.8: Describe --colour option, drop --nocolour. --- ChangeLog | 7 +++++++ emacs-updater | 32 +++++++++++++++++++++++--------- emacs-updater.8 | 18 ++++++++++++++---- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a17828a..1ba2684 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2013-03-09 Ulrich Müller + * emacs-updater (OPTIONS): New long option --colour=, + compatible with the same option in eselect. Spelling --color is + recognised too. + (COLOUR): Variable renamed from NOCOLOUR. + (usage): Update help text. + * emacs-updater.8: Describe --colour option, drop --nocolour. + * emacs-updater: Remove unneccesary quoting. 2012-10-11 Ulrich Müller diff --git a/emacs-updater b/emacs-updater index ac42692..68c4ac3 100755 --- a/emacs-updater +++ b/emacs-updater @@ -19,9 +19,9 @@ PM_EXTRAOPTS=( ) # Other default variable settings BATCH= +COLOUR= EXACT= MAJOR= -NOCOLOUR= ORPHANS= PRETEND= @@ -41,11 +41,14 @@ usage() { X byte-compiled Elisp files X (default: sitedir,rebuild) X -b, --batch batch mode, don't ask any questions + X --color MODE, --colour=MODE + X control colour output. MODE is 'yes', 'no', + X or 'auto'. For 'auto', colour is enabled + X if standard output is to a terminal + X (default: auto) X -e, --exact match exact versions when remerging packages X -m, --major use only the major version when comparing X Emacs version numbers - X -n, --nocolour, --nocolor - X disable colour in output X -o, --orphans list orphan files (implies '--action all') X -p, --pretend don't actually emerge packages X -P, --package-manager PM @@ -104,8 +107,8 @@ pm_auto() { # Read in all command-line options and force English output OPTIONS=$(LC_ALL=C getopt -o a:behmnopP: \ - --long action:,batch,exact,help,major,nocolour,nocolor,orphans,pretend \ - --long package-manager:,package-manager-command:,version \ + --long action:,batch,color:,colour:,nocolor,nocolour,exact,help,major \ + --long orphans,pretend,package-manager:,package-manager-command:,version \ -n 'emacs-updater' -- "$@") [ $? -eq 0 ] || usage 1 @@ -121,7 +124,19 @@ do -m|--major) MAJOR="true"; shift ;; -o|--orphans) ORPHANS="true"; ACTIONS="all"; shift ;; -p|--pretend) PRETEND="true"; shift ;; - -n|--nocolour|--nocolor) NOCOLOUR="true"; shift ;; + --color|--colour) + case $2 in + yes|y|always|force) COLOUR="yes" ;; + no|n|never|none) COLOUR="no" ;; + auto|tty|if-tty) COLOUR="" ;; + *) + echo "Invalid argument for '$1' option" + usage 20 + ;; + esac + shift 2 + ;; + -n|--nocolor|--nocolour) COLOUR="no"; shift ;; # legacy option -a|--action) ACTIONS= for action in ${2/,/ }; do @@ -164,9 +179,8 @@ do esac done -# Only set colours if output is not redirected or the --nocolour -# option is not set -if [ -t 1 ] && [ -z "${NOCOLOUR}" ] ; then +# Set colours based on the --colour option and output redirection status +if [ -z "${COLOUR}" -a -t 1 -o "${COLOUR}" = "yes" ]; then BOLD=$(tput bold) NORMAL=$(tput sgr0) RED=$(tput setaf 1)${BOLD} diff --git a/emacs-updater.8 b/emacs-updater.8 index afa9995..c534020 100644 --- a/emacs-updater.8 +++ b/emacs-updater.8 @@ -2,7 +2,7 @@ .\" Copyright 2008-2013 Gentoo Foundation .\" Distributed under the terms of the GNU General Public License v2 or later .\" -.TH emacs-updater 8 "October 2012" "Gentoo Linux" +.TH emacs-updater 8 "January 2013" "Gentoo Linux" .SH NAME emacs-updater \- rebuild Emacs packages .SH SYNOPSIS @@ -33,15 +33,25 @@ Rebuild all packages that have byte-compiled Elisp files. .B -b, --batch Batch mode, don't ask the user any questions. .TP +.BI \-\-color= "mode, " \-\-colour= mode +Enable or disable colour output. +.I mode +can be +.BR yes , +.BR no , +or +.BR auto . +The default is +.BR auto , +for which colour output is enabled only if standard output is +connected to a terminal. +.TP .B -e, --exact Match exact versions when remerging packages. .TP .B -m, --major Use only the major version when comparing Emacs version numbers. .TP -.B -n, --nocolour, --nocolor -Disable colour in output. -.TP .B -o, --orphans List orphan files, i.e. files that are not owned by any package. Implies