* [gentoo-commits] eselect r854 - in trunk: . bin man misc
@ 2011-10-28 23:43 Ulrich Mueller (ulm)
0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2011-10-28 23:43 UTC (permalink / raw
To: gentoo-commits
Author: ulm
Date: 2011-10-28 23:43:52 +0000 (Fri, 28 Oct 2011)
New Revision: 854
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/bin/eselect.in
trunk/man/eselect.1
trunk/misc/eselect.bashcomp
Log:
New global option --colour=<yes|no|auto>.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-10-28 23:12:56 UTC (rev 853)
+++ trunk/ChangeLog 2011-10-28 23:43:52 UTC (rev 854)
@@ -1,3 +1,13 @@
+2011-10-29 Ulrich Mueller <ulm@gentoo.org>
+
+ * bin/eselect.in: New option --colour=<yes|no|auto>, similar to
+ the same option in emerge and ls commands. Spelling --color is
+ recognised too.
+ (es_do_list_options): Update accordingly.
+ (ESELECT_OPTIONS): Remove unused global variable.
+ * man/eselect.1: Document the --colour option.
+ * misc/eselect.bashcomp (_eselect): Update.
+
2011-10-27 Ulrich Mueller <ulm@gentoo.org>
* modules/news.eselect (do_list): Display read/unread flags as one
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2011-10-28 23:12:56 UTC (rev 853)
+++ trunk/NEWS 2011-10-28 23:43:52 UTC (rev 854)
@@ -4,6 +4,7 @@
New features:
- The profile module supports profiles in overlays (bug #265264).
- Changed output formatting in news module (bug #388233).
+ - New global option --colour=<yes|no|auto>.
1.2.18:
Bug fixes:
Modified: trunk/bin/eselect.in
===================================================================
--- trunk/bin/eselect.in 2011-10-28 23:12:56 UTC (rev 853)
+++ trunk/bin/eselect.in 2011-10-28 23:43:52 UTC (rev 854)
@@ -41,9 +41,6 @@
ESELECT_BINARY_NAME="$0"
ESELECT_KILL_TARGET="$$"
-# Global options
-ESELECT_OPTIONS=""
-
# Support variables for Gentoo Prefix
EPREFIX="@EPREFIX@"
EROOT="${ROOT}${EPREFIX}"
@@ -112,8 +109,9 @@
# Display all recognized global options
es_do_list_options() {
write_list_start "Global options:"
- write_kv_list_entry "--brief" "Make output shorter"
- write_kv_list_entry "--no-color,--no-colour" "Disable coloured output"
+ write_kv_list_entry "--brief" "Make output shorter"
+ write_kv_list_entry "--colour=<yes|no|auto>" \
+ "Enable or disable colour output (default 'auto')"
}
# es_do_list_modules
@@ -124,14 +122,6 @@
### main code ###
-# enable colour output and get width of terminal iff stdout is a tty
-if [[ -t 1 ]]; then
- colours
- init_columns
-else
- nocolours
-fi
-
# figure out what the action is. we need to know whether we're
# invoked as a something-config/something-update.
action=""
@@ -161,13 +151,20 @@
while [[ ${1##--} != "$1" ]]; do
case ${1##--} in
brief)
- ESELECT_OPTIONS="${ESELECT_OPTIONS} brief"
set_output_mode brief
;;
- no-colour|no-color)
- ESELECT_OPTIONS="${ESELECT_OPTIONS} no-colour"
- nocolours
+ colour=*|color=*|colour|color)
+ # accept all arguments that are valid for ls or emerge
+ case ${1#*=} in
+ yes|y|always|force|$1) colour=yes ;;
+ no|n|never|none) colour=no ;;
+ auto|tty|if-tty) colour="" ;;
+ *) die -q "Invalid argument for ${1%%=*} option" ;;
+ esac
;;
+ no-colour|no-color) # legacy option
+ colour=no
+ ;;
help|version)
action=${1##--}
;;
@@ -183,6 +180,15 @@
fi
fi
+# enable colour output and get width of terminal iff stdout is a tty
+if [[ -t 1 ]]; then
+ if [[ ${colour} = no ]]; then nocolours; else colours; fi
+ init_columns
+else
+ if [[ ${colour} = yes ]]; then colours; else nocolours; fi
+fi
+unset colour
+
if [[ -n ${action} ]]; then
if is_function "es_do_${action//-/_}"; then
[[ $# -gt 0 ]] && die -q "Too many parameters"
Modified: trunk/man/eselect.1
===================================================================
--- trunk/man/eselect.1 2011-10-28 23:12:56 UTC (rev 853)
+++ trunk/man/eselect.1 2011-10-28 23:43:52 UTC (rev 854)
@@ -2,7 +2,7 @@
.\" Distributed under the terms of the GNU General Public License v2
.\" $Id$
.\"
-.TH ESELECT 1 "August 2009" "Gentoo Linux" eselect
+.TH ESELECT 1 "October 2011" "Gentoo Linux" eselect
.SH NAME
eselect \- Gentoo's multi\-purpose configuration and management tool
.SH SYNOPSIS
@@ -20,8 +20,18 @@
Set brief output mode, for use as input to other programs.
(This is an experimental feature.)
.TP
-.BR \-\-no-color ", " \-\-no-colour
-Disable coloured output.
+.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.
.SH BUILT-INS
.TP
.B help
Modified: trunk/misc/eselect.bashcomp
===================================================================
--- trunk/misc/eselect.bashcomp 2011-10-28 23:12:56 UTC (rev 853)
+++ trunk/misc/eselect.bashcomp 2011-10-28 23:43:52 UTC (rev 854)
@@ -8,7 +8,7 @@
_eselect() {
local cur sedcmd2 sedcmd3 possibles
- local options="--brief --no-colour"
+ local options="--brief --colour="
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
sedcmd2='s/^ \([[:alnum:]-][[:alnum:]_-]*\)[[:space:],].*$/\1/p'
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-28 23:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 23:43 [gentoo-commits] eselect r854 - in trunk: . bin man misc Ulrich Mueller (ulm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox