summaryrefslogtreecommitdiff
path: root/completions/cvs
diff options
context:
space:
mode:
Diffstat (limited to 'completions/cvs')
-rw-r--r--completions/cvs132
1 files changed, 70 insertions, 62 deletions
diff --git a/completions/cvs b/completions/cvs
index fee256f2..0fb49f9c 100644
--- a/completions/cvs
+++ b/completions/cvs
@@ -4,7 +4,7 @@ _cvs_entries()
{
local prefix=${cur%/*}/ IFS=$'\n'
[[ -e ${prefix:-}CVS/Entries ]] || prefix=""
- entries=( $( cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null ) )
+ entries=( $(cut -d/ -f2 -s ${prefix:-}CVS/Entries 2>/dev/null) )
if [[ $entries ]]; then
entries=( "${entries[@]/#/${prefix:-}}" )
compopt -o filenames
@@ -14,9 +14,9 @@ _cvs_entries()
_cvs_modules()
{
if [[ -n $prefix ]]; then
- COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
+ COMPREPLY=( $(command ls -d ${cvsroot}/${prefix}/!(CVSROOT)) )
else
- COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
+ COMPREPLY=( $(command ls -d ${cvsroot}/!(CVSROOT)) )
fi
}
@@ -27,21 +27,21 @@ _cvs_commands()
_cvs_command_options()
{
- COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $2" )' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '$(_parse_help "$1" "--help $2")' -- "$cur") )
}
_cvs_kflags()
{
- COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W 'kv kvl k o b v' -- "$cur") )
}
_cvs_roots()
{
local -a cvsroots
cvsroots=( $CVSROOT )
- [[ -r ~/.cvspass ]] && cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
- [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots < CVS/Root
- COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
+ [[ -r ~/.cvspass ]] && cvsroots+=( $(awk '{ print $2 }' ~/.cvspass) )
+ [[ -r CVS/Root ]] && mapfile -tO ${#cvsroots[@]} cvsroots <CVS/Root
+ COMPREPLY=( $(compgen -W '${cvsroots[@]}' -- "$cur") )
__ltrim_colon_completions "$cur"
}
@@ -62,11 +62,11 @@ _cvs()
fi
if [[ -z $mode ]]; then
case $i in
- -H|--help)
- COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) )
+ --help|-!(-*)H)
+ COMPREPLY=( $(compgen -W "$(_cvs_commands)" -- "$cur") )
return
;;
- -d)
+ -!(-*)d)
mode=cvsroot
cvsroot=${words[((count+1))]}
;;
@@ -134,16 +134,17 @@ _cvs()
elif [[ "$i" == -* ]]; then
flags+=( $i )
fi
- count=$((++count))
+ (( count++ ))
done
case $mode in
add)
case $prev in
- -m)
+ --*) ;;
+ -*m)
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -152,9 +153,9 @@ _cvs()
if [[ "$cur" != -* ]]; then
_cvs_entries
[[ -z $cur ]] && files=( !(CVS) ) || \
- files=( $( command ls -d ${cur}* 2>/dev/null ) )
+ files=( $(command ls -d ${cur}* 2>/dev/null) )
local f
- for i in ${!files[@]}; do
+ for i in "${!files[@]}"; do
if [[ ${files[i]} == ?(*/)CVS ]]; then
unset 'files[i]'
else
@@ -166,22 +167,23 @@ _cvs()
done
fi
done
- COMPREPLY=( $( compgen -X "$_backup_glob" -W '${files[@]}' \
- -- "$cur" ) )
+ COMPREPLY=( $(compgen -X "$_backup_glob" -W '${files[@]}' \
+ -- "$cur") )
else
_cvs_command_options "$1" $mode
fi
;;
admin)
case $prev in
- -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u)
+ --*) ;;
+ -*@([aAbcelmnNosu]|t-))
return
;;
- -t)
+ -*t)
_filedir
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -191,7 +193,7 @@ _cvs()
_cvs_command_options "$1" $mode
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") )
fi
;;
annotate)
@@ -201,19 +203,20 @@ _cvs()
_cvs_command_options "$1" $mode
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") )
fi
;;
checkout)
case $prev in
- -r|-D|-j)
+ --*) ;;
+ -*[rDj])
return
;;
- -d)
+ -*d)
_filedir -d
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -221,19 +224,20 @@ _cvs()
if [[ "$cur" != -* ]]; then
[[ -z $cvsroot ]] && cvsroot=$CVSROOT
- COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
- awk '{print $1}' ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ COMPREPLY=( $(cvs -d "$cvsroot" co -c 2>/dev/null | \
+ awk '{print $1}') )
+ COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
else
_cvs_command_options "$1" $mode
fi
;;
commit)
case $prev in
- -m|-r)
+ --*) ;;
+ -*[mr])
return
;;
- -F)
+ -*F)
_filedir
return
;;
@@ -247,15 +251,15 @@ _cvs()
# this is the least computationally intensive way found so
# far, but other changes (something other than
# changed/removed/new) may be missing
- changed=( $( cvs -q diff --brief 2>&1 | \
- command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
- newremoved=( $( cvs -q diff --brief 2>&1 | \
- command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
- COMPREPLY=( $( compgen -W '${changed[@]:-} \
- ${newremoved[@]:-}' -- "$cur" ) )
+ changed=( $(cvs -q diff --brief 2>&1 | \
+ command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p') )
+ newremoved=( $(cvs -q diff --brief 2>&1 | \
+ command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p') )
+ COMPREPLY=( $(compgen -W '${changed[@]:-} \
+ ${newremoved[@]:-}' -- "$cur") )
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") )
fi
else
_cvs_command_options "$1" $mode
@@ -264,13 +268,13 @@ _cvs()
cvsroot)
_cvs_roots
;;
- diff)
+ diff|log)
if [[ "$cur" == -* ]]; then
_cvs_command_options "$1" $mode
[[ $COMPREPLY == *= ]] && compopt -o nospace
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]:-}' -- "$cur") )
fi
;;
editors|watchers)
@@ -278,19 +282,20 @@ _cvs()
_cvs_command_options "$1" $mode
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") )
fi
;;
export)
case $prev in
- -r|-D)
+ --*) ;;
+ -*[rD])
return
;;
- -d)
+ -*d)
_filedir -d
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -298,18 +303,19 @@ _cvs()
if [[ "$cur" != -* ]]; then
[[ -z $cvsroot ]] && cvsroot=$CVSROOT
- COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ COMPREPLY=( $(cvs -d "$cvsroot" co -c | awk '{print $1}') )
+ COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
else
_cvs_command_options "$1" $mode
fi
;;
import)
case $prev in
- -I|-b|-m|-W)
+ --*) ;;
+ -*[IbmW])
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -324,9 +330,9 @@ _cvs()
COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
COMPREPLY=( ${COMPREPLY[@]#\/} )
fi
- pwd=$( pwd )
+ pwd=$(pwd)
pwd=${pwd##*/}
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${COMPREPLY[@]} $pwd' -- "$cur") )
else
_cvs_command_options "$1" $mode
fi
@@ -336,21 +342,22 @@ _cvs()
_cvs_entries
if [[ "$prev" != -f ]]; then
# find out what files are missing
- for i in ${!entries[@]}; do
+ for i in "${!entries[@]}"; do
[[ -r "${entries[i]}" ]] && unset 'entries[i]'
done
fi
- COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]:-}' -- "$cur") )
else
_cvs_command_options "$1" $mode
fi
;;
update)
case $prev in
- -r|-D|-j|-I|-W)
+ --*) ;;
+ -*[rDjIW])
return
;;
- -k)
+ -*k)
_cvs_kflags
return
;;
@@ -360,27 +367,28 @@ _cvs()
_cvs_command_options "$1" $mode
else
_cvs_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '${entries[@]}' -- "$cur") )
fi
;;
"")
case $prev in
- -T)
+ --*) ;;
+ -*T)
_filedir -d
return
;;
- -e|-s)
+ -*[es])
return
;;
- -z)
- COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
+ -*z)
+ COMPREPLY=( $(compgen -W '{1..9}' -- "$cur") )
return
;;
esac
- COMPREPLY=( $( compgen -W '$( _cvs_commands )
- $( _parse_help "$1" --help-options ) --help --help-commands
- --help-options --version' -- "$cur" ) )
+ COMPREPLY=( $(compgen -W '$(_cvs_commands)
+ $(_parse_help "$1" --help-options) --help --help-commands
+ --help-options --version' -- "$cur") )
;;
esac