public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect:master commit in: /, misc/, bin/, modules/
Date: Tue, 19 Nov 2013 08:17:23 +0000 (UTC)	[thread overview]
Message-ID: <1384502491.90540744262d70f4e7e56437ce532b35e3382b29.ulm@gentoo> (raw)

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"


                 reply	other threads:[~2013-11-19  8:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384502491.90540744262d70f4e7e56437ce532b35e3382b29.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox