public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ryan Hill" <dirtyepic@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bashcomp:master commit in: /
Date: Sun, 21 Oct 2012 09:57:53 +0000 (UTC)	[thread overview]
Message-ID: <1350812952.9c42e4346e7342d20e4a04a85646043de4d9e2de.dirtyepic@gentoo> (raw)

commit:     9c42e4346e7342d20e4a04a85646043de4d9e2de
Author:     Ryan Hill <dirtyepic <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 21 09:49:12 2012 +0000
Commit:     Ryan Hill <dirtyepic <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 09:49:12 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bashcomp.git;a=commit;h=9c42e434

Rewrite repoman completion.

- use _parse_help rather than a hardcoded list of options
- use _get_comp_words_by_ref and _split_longopt for proper handling of
  options requiring arguments
- fix --commitmsgfile to complete on filenames
- add proper completions for --mode and --vcs

---
 repoman |   60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/repoman b/repoman
index c13d334..a4fb080 100644
--- a/repoman
+++ b/repoman
@@ -2,33 +2,63 @@
 #
 # $Id$
 #
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2 or later
 
 # repoman completion by Jeremy Olexa <darkside@gentoo.org>
+# rewrite by Ryan Hill <dirtyepic@gentoo.org>
 
 _repoman()
 {
-	local cur
+	local cur prev opts modes split=false
 
 	COMPREPLY=()
-	cur=`_get_cword`
+	opts="$(_parse_help ${COMP_WORDS[0]}) --commitmsg --commitmsgfile"
+	modes="ci commit fix full help manifest manifest-check scan"
 
-	case "$cur" in
+	_get_comp_words_by_ref -n = cur prev
+	_split_longopt && split=true
+
+		case $prev in
+		-h|--help|help|-m|--commitmsg|-V|--version)
+			return 0
+			;;
+		--commitmsgfile)
+			_filedir
+			return 0
+			;;
+		--digest|--if-modified)
+			COMPREPLY=( $(compgen -W 'y n' -- "$cur") )
+			return 0
+			;;
+		--echangelog)
+			COMPREPLY=( $(compgen -W 'y n force' -- "$cur") )
+			return 0
+			;;
+		--mode)
+			COMPREPLY=( $(compgen -W "${modes}" -- "$cur") )
+			return 0
+			;;
+		--vcs)
+			COMPREPLY=( $(compgen -W 'cvs svn git bzr hg' -- "$cur") )
+			return 0
+			;;
+	esac
+
+	$split && return 0
+
+	case $cur in
 		-*)
-		COMPREPLY=( $( compgen -W '-h --help -m -M -p --pretend -q --quiet -f \
-		--force -v --verbose -V --version -x --xmlparse -i --ignore-arches -I \
-		--ignore-masked -d --include-dev --without-mask --mode=' -- $cur ) )
-		;;
+			COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
+			return 0
+			;;
 		*)
-		if [ $COMP_CWORD -eq 1 ]; then
-			COMPREPLY=( $( compgen -W 'ci commit fix full help manifest scan' \
-			-- $cur ) )
-		fi
-		;;
+			COMPREPLY=( $(compgen -W "$modes" -- "$cur") )
+			return 0
+			;;
 	esac
 
 	return 0
-
 }
-complete -F _repoman -o filenames repoman
+
+complete -F _repoman repoman


             reply	other threads:[~2012-10-21  9:58 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21  9:57 Ryan Hill [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-25  7:54 [gentoo-commits] proj/gentoo-bashcomp:master commit in: / Arthur Zamarin
2024-05-11  3:13 Sam James
2018-03-02 18:06 Michał Górny
2014-08-31 21:19 ` Michał Górny
2016-03-16 11:55 Patrice Clement
2016-01-14 13:19 Patrice Clement
2016-01-14 13:19 Patrice Clement
2015-10-10 20:18 Patrice Clement
2014-08-31 21:19 Michał Górny
2018-03-02 18:06 ` Michał Górny
2013-08-12 16:43 Ryan Hill
2013-08-12 16:43 Ryan Hill
2013-08-04 19:21 Ryan Hill
2013-08-04 19:21 Ryan Hill
2013-07-30  1:36 Ryan Hill
2012-11-03  5:51 Ryan Hill
2012-10-24  4:01 Ryan Hill
2012-10-24  3:42 Ryan Hill
2012-10-24  3:42 Ryan Hill
2012-10-22  3:37 Ryan Hill
2012-10-22  0:51 Ryan Hill
2012-10-11  5:01 Ryan Hill
2012-10-10  2:43 Ryan Hill
2012-10-10  2:43 Ryan Hill
2012-10-10  2:43 Ryan Hill
2012-05-06 20:35 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-04-24 16:10 Jeremy Olexa
2012-02-15  2:16 Christian Ruppert

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=1350812952.9c42e4346e7342d20e4a04a85646043de4d9e2de.dirtyepic@gentoo \
    --to=dirtyepic@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