diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-08 12:47:34 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-08 12:47:34 +0100 |
commit | c9c202e3703e549242ff2bb828ae2113fb9f541c (patch) | |
tree | 3a94f642cde81d565afe370f5a5edcbc1ba2b194 /provides/zsh/completions/_pkg | |
parent | c20d7f7f1e362172ce02d7c6233b452c1f677dc1 (diff) |
Added arguments (-q etc) to zsh completion
Diffstat (limited to 'provides/zsh/completions/_pkg')
-rw-r--r-- | provides/zsh/completions/_pkg | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg index 5e8ce9f..b28b1b3 100644 --- a/provides/zsh/completions/_pkg +++ b/provides/zsh/completions/_pkg @@ -28,45 +28,52 @@ function _pkg_notinstalled () { compadd $(diff <(pkg list) <(pkg list-all) | grep "^>" | cut -d " " -f 2) } -if (( CURRENT == 2 )) { - _pkg_action -} elif (( CURRENT == 3 )) { - case ${words[2]} in - changelog|check|delete|log|pull|push|refresh|remove|status|upgrade) - _pkg_installed - ;; - info) - _pkg_all - ;; - add|install) - _pkg_notinstalled - ;; - eval) - _message 'shell code for evaluation' - _wanted function expl 'internal function' \ - compadd $(grep -E '^\S*\s*\(\)\s*{' =pkg | cut -d ' ' -f 1) \ - $(grep -E 'function \S* (\(\) )?{' =pkg | cut -d ' ' -f 2) - ;; - *) - _message 'no more arguments' - ;; - esac -} elif [[ ${words[2]} = 'eval' ]] { - _message 'shell code for evaluation' - if (( CURRENT == 4 )) { - case ${words[3]} in - exec_hook|check_prereqs|*_collected|) +function _pkg_args { + if (( CURRENT == 2 )) { + case ${words[1]} in + changelog|check|delete|log|pull|push|refresh|remove|status|upgrade) _pkg_installed ;; - esac - } elif (( CURRENT == 5 )) { - case ${words[3]} in - exec_hook) - _wanted hook expl 'package hook' \ - compadd $(ls -1 ~/packages/${words[4]}/hooks 2> /dev/null) + info) + _pkg_all + ;; + add|install) + _pkg_notinstalled + ;; + eval) + _message 'shell code for evaluation' + _wanted function expl 'internal function' \ + compadd $(grep -E '^\S*\s*\(\)\s*{' =pkg | cut -d ' ' -f 1) \ + $(grep -E 'function \S* (\(\) )?{' =pkg | cut -d ' ' -f 2) + ;; + *) + _message 'no more arguments' ;; esac + } elif [[ ${words[1]} = 'eval' ]] { + _message 'shell code for evaluation' + if (( CURRENT == 3 )) { + case ${words[2]} in + exec_hook|check_prereqs|*_collected|) + _pkg_installed + ;; + esac + } elif (( CURRENT == 4 )) { + case ${words[2]} in + exec_hook) + _wanted hook expl 'package hook' \ + compadd $(ls -1 ~/packages/${words[3]}/hooks 2> /dev/null) + ;; + esac + } } -} else { - _message 'no more arguments' } + +_arguments \ + {-q,--quiet}'[quiet mode]' \ + {-d,--debug}'[debugmode]' \ + {-au,--auto-update}'[automatically update package list]' \ + '*'{-co,--checklinks-options}'[options for checklinks]:option' \ + {-p,--packagedir}'[package directory]:directory:_files -/' \ + ':action:_pkg_action' \ + '*::arguments:_pkg_args' |