- Add ,v files to list rcs(1) can complete on. From Ed Catmur

<ed@catmur.co.uk> via Aaron Walker <ka0ttic@gentoo.org>.
This commit is contained in:
ianmacd 2005-01-02 23:48:27 +00:00
parent 9fe226a1f7
commit 21c61a550e

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b
#
# $Id: bash_completion,v 1.761 2004/11/22 21:20:43 ianmacd Exp $
# $Id: bash_completion,v 1.762 2005/01/03 00:48:27 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -4392,7 +4392,7 @@ complete -F _perldoc $default perldoc
have rcs &&
_rcs()
{
local cur prev file dir
local cur prev file dir i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
@ -4408,11 +4408,16 @@ _rcs()
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
file=${COMPREPLY[$i]##*/}
file=${file%,v}
dir=${COMPREPLY[$i]%RCS/*}
COMPREPLY[$i]=$dir$file
done
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
done
# default to files if nothing returned and we're checking in.
# otherwise, default to directories
[ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d