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=()
|
2010-02-08 17:25:08 +01:00
|
|
|
_get_comp_words_by_ref cur prev
|
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
|
2009-11-23 20:08:52 +02:00
|
|
|
[[ ${#COMPREPLY[@]} -eq 0 && $1 == ci ]] && _filedir || _filedir -d
|
2009-05-27 18:45:51 +02:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _rcs 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
|