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 08504138010 for ; Sun, 21 Oct 2012 09:58:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 020D521C063; Sun, 21 Oct 2012 09:57:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 76EF821C063 for ; Sun, 21 Oct 2012 09:57:56 +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 AE7D333D7F2 for ; Sun, 21 Oct 2012 09:57:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 51A04E5436 for ; Sun, 21 Oct 2012 09:57:53 +0000 (UTC) From: "Ryan Hill" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ryan Hill" Message-ID: <1350812952.9c42e4346e7342d20e4a04a85646043de4d9e2de.dirtyepic@gentoo> Subject: [gentoo-commits] proj/gentoo-bashcomp:master commit in: / X-VCS-Repository: proj/gentoo-bashcomp X-VCS-Files: repoman X-VCS-Directories: / X-VCS-Committer: dirtyepic X-VCS-Committer-Name: Ryan Hill X-VCS-Revision: 9c42e4346e7342d20e4a04a85646043de4d9e2de X-VCS-Branch: master Date: Sun, 21 Oct 2012 09:57:53 +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: 7f64a732-f344-45f0-91b5-7cfaf5b85dae X-Archives-Hash: 9748702de723b77180e018635b87a161 commit: 9c42e4346e7342d20e4a04a85646043de4d9e2de Author: Ryan Hill gentoo org> AuthorDate: Sun Oct 21 09:49:12 2012 +0000 Commit: Ryan Hill gentoo 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 +# rewrite by Ryan Hill _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