diff options
Diffstat (limited to 'completions/dpkg-source')
-rw-r--r-- | completions/dpkg-source | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/completions/dpkg-source b/completions/dpkg-source index ffc34c41..05fa3a11 100644 --- a/completions/dpkg-source +++ b/completions/dpkg-source @@ -5,7 +5,7 @@ _dpkg_source() local cur prev words cword _init_completion || return - local options work i action packopts unpackopts fields + local options word action packopts unpackopts fields packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \ -sU -sR" @@ -14,13 +14,13 @@ _dpkg_source() fields="Format Source Version Binary Maintainer Uploader Architecture \ Standards-Version Build-Depends Files" - action="options" - for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[$i]} == "-x" ]]; then + action=options + for word in "${words[@]:1}"; do + if [[ $word == -x ]]; then action=unpack - elif [[ ${words[$i]} == "-b" ]]; then + elif [[ $word == -b ]]; then action=pack - elif [[ ${words[$i]} == "-h" ]]; then + elif [[ $word == -h ]]; then action=help fi done @@ -33,7 +33,7 @@ _dpkg_source() _filedir 'dsc' ;; *) - COMPREPLY=( $(compgen -W "$unpackopts" -- "$cur") ) + COMPREPLY=($(compgen -W "$unpackopts" -- "$cur")) _filedir -d _filedir ;; @@ -45,7 +45,7 @@ _dpkg_source() -b) _filedir -d ;; - -c|-l|-T|-i|-I) + -c | -l | -T | -i | -I) # -c: get controlfile # -l: get per-version info from this file # -T: read variables here, not debian/substvars @@ -57,9 +57,9 @@ _dpkg_source() ;; -F) # -F: force change log format - COMPREPLY=( $(command ls /usr/lib/dpkg/parsechangelog) ) + COMPREPLY=($(command ls /usr/lib/dpkg/parsechangelog)) ;; - -V|-D) + -V) # -V: set a substitution variable # we don't know anything about possible variables or values # so we don't try to suggest any completion. @@ -68,31 +68,31 @@ _dpkg_source() -D) # -D: override or add a .dsc field and value # if $cur doesn't contain a = yet, suggest variable names - if [[ "$cur" == *=* ]]; then + if [[ $cur == *=* ]]; then # $cur contains a "=" COMPREPLY=() else - COMPREPLY=( $(compgen -W "$fields" -- "$cur") ) + COMPREPLY=($(compgen -W "$fields" -- "$cur")) fi ;; -U) # -U: remove a field # Suggest possible fieldnames - COMPREPLY=( $(compgen -W "$fields" -- "$cur") ) + COMPREPLY=($(compgen -W "$fields" -- "$cur")) ;; *) - COMPREPLY=( $(compgen -W "$packopts $unpackopts" \ - -- "$cur") ) + COMPREPLY=($(compgen -W "$packopts $unpackopts" \ + -- "$cur")) ;; esac return ;; *) - COMPREPLY=( $(compgen -W "$options" -- "$cur") ) + COMPREPLY=($(compgen -W "$options" -- "$cur")) return ;; esac } && -complete -F _dpkg_source dpkg-source + complete -F _dpkg_source dpkg-source # ex: filetype=sh |