public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eselect:master commit in: /, misc/, bin/, modules/
@ 2013-11-19  8:17 Ulrich Müller
  0 siblings, 0 replies; only message in thread
From: Ulrich Müller @ 2013-11-19  8:17 UTC (permalink / raw
  To: gentoo-commits

commit:     90540744262d70f4e7e56437ce532b35e3382b29
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 14 17:28:54 2013 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Nov 15 08:01:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=90540744

New local option --only-names in modules list action.

* modules/modules.eselect (do_list): New local option --only-names
will output names of modules only, without their description.
This replaces the previous brief output mode behaviour and is
mainly intended for bash completion.
(describe_list_options): New function, documents --only-names.
* bin/eselect.in (es_do_help): Don't force default output mode.
* misc/eselect.bashcomp (_eselect): Call "eselect modules list"
with --only-names option.

---
 ChangeLog               |  9 +++++++++
 bin/eselect.in          |  1 -
 misc/eselect.bashcomp   |  4 ++--
 modules/modules.eselect | 16 ++++++++++++----
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 16e368f..9390b25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-11-15  Ulrich Müller  <ulm@gentoo.org>
 
+	* modules/modules.eselect (do_list): New local option --only-names
+	will output names of modules only, without their description.
+	This replaces the previous brief output mode behaviour and is
+	mainly intended for bash completion.
+	(describe_list_options): New function, documents --only-names.
+	* bin/eselect.in (es_do_help): Don't force default output mode.
+	* misc/eselect.bashcomp (_eselect): Call "eselect modules list"
+	with --only-names option.
+
 	* misc/eselect.bashcomp (_eselect): Suggest possible completions
 	also for an empty list of words, i.e. when the user has not typed
 	any parameters yet.

diff --git a/bin/eselect.in b/bin/eselect.in
index b3b7c9e..15118f1 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -79,7 +79,6 @@ es_do_usage() {
 # es_do_help
 # Display eselect help
 es_do_help() {
-	set_output_mode default
 	es_do_usage
 	echo
 	# display all recognized global options

diff --git a/misc/eselect.bashcomp b/misc/eselect.bashcomp
index ae5d40d..337ab4b 100644
--- a/misc/eselect.bashcomp
+++ b/misc/eselect.bashcomp
@@ -25,8 +25,8 @@ _eselect() {
     done
 
     case $# in
-        0|1) possibles="${options} $(eselect --brief modules list 2>/dev/null)"
-            ;;
+        0|1) possibles="${options} $(eselect modules list --only-names \
+            2>/dev/null)" ;;
         2) possibles=$(eselect --brief "$1" usage 2>/dev/null \
             | sed -n -e "${sedcmd2}") ;;
         3)

diff --git a/modules/modules.eselect b/modules/modules.eselect
index 6a808ec..452321d 100644
--- a/modules/modules.eselect
+++ b/modules/modules.eselect
@@ -15,13 +15,21 @@ describe_list() {
 	echo "List all available modules"
 }
 
+describe_list_options() {
+	echo "--only-names : Output names of modules only"
+}
+
 # List all installed modules
 do_list() {
-	[[ $# -gt 0 ]] && die -q "Too many parameters"
-
-	local path file module name desc
+	local only_names path file module name desc
 	local -a extra_modules
 
+	if [[ ${1#--} = only-names ]]; then
+		only_names=1
+		shift
+	fi
+	[[ $# -gt 0 ]] && die -q "Too many parameters"
+
 	for path in "${ESELECT_MODULES_PATH[@]}" ; do
 		[[ -d ${path} ]] || continue
 		for file in "${path}"/*.eselect ; do
@@ -30,7 +38,7 @@ do_list() {
 		done
 	done
 
-	if is_output_mode brief; then
+	if [[ -n ${only_names} ]]; then
 		# This is mainly intended for bash completion
 		echo "help"
 		echo "usage"


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-19  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19  8:17 [gentoo-commits] proj/eselect:master commit in: /, misc/, bin/, modules/ Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox