2009-05-27 18:45:51 +02:00
|
|
|
# bash completion for rcs
|
|
|
|
|
|
|
|
have rcs &&
|
|
|
|
_rcs()
|
|
|
|
{
|
2009-10-04 19:42:50 +02:00
|
|
|
local cur prev file dir i
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
file=${cur##*/}
|
|
|
|
dir=${cur%/*}
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# deal with relative directory
|
|
|
|
[ "$file" = "$dir" ] && dir=.
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
file=${COMPREPLY[$i]##*/}
|
|
|
|
dir=${COMPREPLY[$i]%RCS/*}
|
|
|
|
COMPREPLY[$i]=$dir$file
|
|
|
|
done
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
|
|
|
|
done
|
2009-05-27 18:45:51 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# default to files if nothing returned and we're checking in.
|
|
|
|
# otherwise, default to directories
|
|
|
|
[ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
|
2009-05-27 18:45:51 +02:00
|
|
|
} &&
|
2009-10-22 12:04:29 +03:00
|
|
|
complete -F _rcs -o filenames ci co rlog rcs rcsdiff
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|