diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2017-09-25 23:46:54 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2017-09-25 23:46:54 -0300 |
commit | 6d88f1055806932d9291f96847d2b691cccda2cd (patch) | |
tree | 0ff79eedaa8a239331256048981deedbd0721965 /completions/cvs | |
parent | 059a87a5936cfebfd2d71ab8057002cafb2ea051 (diff) | |
download | bash-completion-6d88f1055806932d9291f96847d2b691cccda2cd.tar.gz |
New upstream version 2.7upstream/2.7
Diffstat (limited to 'completions/cvs')
-rw-r--r-- | completions/cvs | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/completions/cvs b/completions/cvs index 71277556..fee256f2 100644 --- a/completions/cvs +++ b/completions/cvs @@ -51,7 +51,7 @@ _cvs() _init_completion -n : || return local count mode i cvsroot cvsroots pwd - local -a flags miss files entries changed newremoved + local -a flags files entries changed newremoved count=0 for i in "${words[@]}"; do @@ -64,7 +64,7 @@ _cvs() case $i in -H|--help) COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) ) - return 0 + return ;; -d) mode=cvsroot @@ -131,7 +131,7 @@ _cvs() mode=version ;; esac - elif [[ "$i" = -* ]]; then + elif [[ "$i" == -* ]]; then flags+=( $i ) fi count=$((++count)) @@ -141,11 +141,11 @@ _cvs() add) case $prev in -m) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -156,11 +156,11 @@ _cvs() local f for i in ${!files[@]}; do if [[ ${files[i]} == ?(*/)CVS ]]; then - unset files[i] + unset 'files[i]' else for f in "${entries[@]}"; do if [[ ${files[i]} == $f && ! -d $f ]]; then - unset files[i] + unset 'files[i]' break fi done @@ -175,19 +175,19 @@ _cvs() admin) case $prev in -a|-A|-b|-c|-e|-l|-m|-n|-N|-o|-s|-t-|-u) - return 0 + return ;; -t) _filedir - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -195,9 +195,9 @@ _cvs() fi ;; annotate) - [[ "$prev" == -@(r|D) ]] && return 0 + [[ "$prev" == -[rD] ]] && return - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -206,16 +206,16 @@ _cvs() ;; checkout) case $prev in - -r|-D|j) - return 0 + -r|-D|-j) + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -231,11 +231,11 @@ _cvs() commit) case $prev in -m|-r) - return 0 + return ;; -F) _filedir - return 0 + return ;; esac @@ -248,9 +248,9 @@ _cvs() # far, but other changes (something other than # changed/removed/new) may be missing changed=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) + command sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) newremoved=( $( cvs -q diff --brief 2>&1 | \ - sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) + command sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) COMPREPLY=( $( compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- "$cur" ) ) else @@ -274,7 +274,7 @@ _cvs() fi ;; editors|watchers) - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -284,15 +284,15 @@ _cvs() export) case $prev in -r|-D) - return 0 + return ;; -d) _filedir -d - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -307,11 +307,11 @@ _cvs() import) case $prev in -I|-b|-m|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac @@ -334,11 +334,13 @@ _cvs() remove) if [[ "$cur" != -* ]]; then _cvs_entries - # find out what files are missing - for i in "${entries[@]}"; do - [[ ! -r $i ]] && miss+=( $i ) - done - COMPREPLY=( $( compgen -W '${miss[@]:-}' -- "$cur" ) ) + if [[ "$prev" != -f ]]; then + # find out what files are missing + for i in ${!entries[@]}; do + [[ -r "${entries[i]}" ]] && unset 'entries[i]' + done + fi + COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) else _cvs_command_options "$1" $mode fi @@ -346,15 +348,15 @@ _cvs() update) case $prev in -r|-D|-j|-I|-W) - return 0 + return ;; -k) _cvs_kflags - return 0 + return ;; esac - if [[ "$cur" = -* ]]; then + if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode else _cvs_entries @@ -365,14 +367,14 @@ _cvs() case $prev in -T) _filedir -d - return 0 + return ;; -e|-s) - return 0 + return ;; -z) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) - return 0 + return ;; esac @@ -382,8 +384,7 @@ _cvs() ;; esac - return 0 } && complete -F _cvs cvs -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh |