Add bunch of cvs command option completions.
This commit is contained in:
parent
992226b134
commit
d2ce9f59bd
96
contrib/cvs
96
contrib/cvs
@ -38,13 +38,19 @@ _cvs_command_options()
|
|||||||
cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p'
|
cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cvs_kflags()
|
||||||
|
{
|
||||||
|
COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) )
|
||||||
|
}
|
||||||
|
|
||||||
_cvs()
|
_cvs()
|
||||||
{
|
{
|
||||||
local cur count mode i cvsroot cvsroots pwd
|
local cur prev count mode i cvsroot cvsroots pwd
|
||||||
local -a flags miss files entries changed newremoved
|
local -a flags miss files entries changed newremoved
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
for i in "${COMP_WORDS[@]}"; do
|
for i in "${COMP_WORDS[@]}"; do
|
||||||
@ -117,8 +123,6 @@ _cvs()
|
|||||||
up?(d?(ate)))
|
up?(d?(ate)))
|
||||||
mode=update
|
mode=update
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
elif [[ "$i" = -* ]]; then
|
elif [[ "$i" = -* ]]; then
|
||||||
flags=( "${flags[@]}" $i )
|
flags=( "${flags[@]}" $i )
|
||||||
@ -128,6 +132,16 @@ _cvs()
|
|||||||
|
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
add)
|
add)
|
||||||
|
case "$prev" in
|
||||||
|
-m)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
set_prefix
|
set_prefix
|
||||||
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
|
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
|
||||||
@ -146,12 +160,28 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
admin)
|
admin)
|
||||||
|
case "$prev" in
|
||||||
|
-a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-t)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" = -* ]]; then
|
if [[ "$cur" = -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
annotate)
|
annotate)
|
||||||
|
[[ "$prev" == -@(r|D) ]] && return 0
|
||||||
|
|
||||||
if [[ "$cur" = -* ]]; then
|
if [[ "$cur" = -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
@ -161,6 +191,20 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
checkout)
|
checkout)
|
||||||
|
case "$prev" in
|
||||||
|
-r|-D|j)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-d)
|
||||||
|
_filedir -d
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
||||||
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
|
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
|
||||||
@ -172,6 +216,16 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
commit)
|
commit)
|
||||||
|
case "$prev" in
|
||||||
|
-m|-r)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-F)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
set_prefix
|
set_prefix
|
||||||
|
|
||||||
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
|
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
|
||||||
@ -205,6 +259,20 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
export)
|
export)
|
||||||
|
case "$prev" in
|
||||||
|
-r|-D)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-d)
|
||||||
|
_filedir -d
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
||||||
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
|
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
|
||||||
@ -239,6 +307,16 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
import)
|
import)
|
||||||
|
case "$prev" in
|
||||||
|
-I|-b|-m|-W)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
# starts with same algorithm as checkout
|
# starts with same algorithm as checkout
|
||||||
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
||||||
@ -257,6 +335,16 @@ _cvs()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
|
case "$prev" in
|
||||||
|
-r|-D|-j|-I|-W)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-k)
|
||||||
|
_cvs_kflags
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ "$cur" = -* ]]; then
|
if [[ "$cur" = -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
@ -266,8 +354,6 @@ _cvs()
|
|||||||
COMPREPLY=( $( compgen -W '$( _cvs_commands ) $( _cvs_options ) \
|
COMPREPLY=( $( compgen -W '$( _cvs_commands ) $( _cvs_options ) \
|
||||||
--help --help-commands --help-options --version' -- "$cur" ) )
|
--help --help-commands --help-options --version' -- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user