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 2CE7F138247 for ; Tue, 19 Nov 2013 08:17:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A3058E09E4; Tue, 19 Nov 2013 08:17:28 +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 2B927E09E4 for ; Tue, 19 Nov 2013 08:17:27 +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 EF95F33F2DA for ; Tue, 19 Nov 2013 08:17:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3F25EE5459 for ; Tue, 19 Nov 2013 08:17:23 +0000 (UTC) From: "Ulrich Müller" 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 Müller" Message-ID: <1384502491.90540744262d70f4e7e56437ce532b35e3382b29.ulm@gentoo> Subject: [gentoo-commits] proj/eselect:master commit in: /, misc/, bin/, modules/ X-VCS-Repository: proj/eselect X-VCS-Files: ChangeLog bin/eselect.in misc/eselect.bashcomp modules/modules.eselect X-VCS-Directories: / misc/ bin/ modules/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 90540744262d70f4e7e56437ce532b35e3382b29 X-VCS-Branch: master Date: Tue, 19 Nov 2013 08:17:23 +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: 98f2f889-b2ef-4db6-be72-f2d68b273781 X-Archives-Hash: dfe5c8791b8ccb158c66af0b85e199cd commit: 90540744262d70f4e7e56437ce532b35e3382b29 Author: Ulrich Müller gentoo org> AuthorDate: Thu Nov 14 17:28:54 2013 +0000 Commit: Ulrich Müller gentoo 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 + * 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"