- allow 'cvs -d' to complete from ~/.cvspass (modified patch from

Rodrigo Damazio <rodrigo.damazio@poli.usp.br>)
This commit is contained in:
ianmacd 2003-02-08 06:33:51 +00:00
parent b81d694e5c
commit d3e3acfd35

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b # bash_completion - some programmable completion functions for bash 2.05b
# #
# $Id: bash_completion,v 1.527 2003/02/07 18:04:35 ianmacd Exp $ # $Id: bash_completion,v 1.528 2003/02/08 07:33:51 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1009,7 +1009,7 @@ get_modules()
_cvs() _cvs()
{ {
local cur count mode i cvsroot pwd local cur count mode i cvsroot cvsroots pwd
local -a flags miss files entries changed newremoved local -a flags miss files entries changed newremoved
COMPREPLY=() COMPREPLY=()
@ -1018,9 +1018,14 @@ _cvs()
count=0 count=0
for i in ${COMP_WORDS[@]}; do for i in ${COMP_WORDS[@]}; do
[ $count -eq $COMP_CWORD ] && break [ $count -eq $COMP_CWORD ] && break
# Last parameter was the CVSROOT, now go back to mode selection
if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
mode=""
fi
if [ -z "$mode" ]; then if [ -z "$mode" ]; then
case $i in case $i in
-d) -d)
mode=cvsroot
cvsroot=${COMP_WORDS[((count+1))]} cvsroot=${COMP_WORDS[((count+1))]}
;; ;;
@(add|new)) @(add|new))
@ -1128,6 +1133,13 @@ _cvs()
$cur ) ) $cur ) )
fi fi
;; ;;
cvsroot)
if [ -r ~/.cvspass ]; then
# Ugly escaping because of bash treating ':' specially
cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
fi
;;
export) export)
if [[ "$cur" != -* ]]; then if [[ "$cur" != -* ]]; then
[ -z "$cvsroot" ] && cvsroot=$CVSROOT [ -z "$cvsroot" ] && cvsroot=$CVSROOT