From 21906d51ac0cb76e680f4731335452d6e06c540f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 17 Aug 2008 10:54:39 +0200 Subject: Added zsh completion for pkg --- provides/zsh/completions/_pkg | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 provides/zsh/completions/_pkg (limited to 'provides') diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg new file mode 100644 index 0000000..8a621a6 --- /dev/null +++ b/provides/zsh/completions/_pkg @@ -0,0 +1,36 @@ +#compdef pkg +## vim:ft=zsh +## pkg completion +## Daniel Friesel +## https://derf.homelinux.org/~derf/dotfiles/zsh/completions/_pkg +## see also: https://derf.homelinux.org/~derf/code/lighty-stats + +local arguments_action arguments_list arguments_listall +local all installed + +all='pkg list-all' +installed='pkg list' +notinstalled='diff <(eval $installed) <(eval $all) | grep "^>" | cut -d " " -f 2' + +arguments_action=( + '1:action:(add install changelog changeroot check delete remove info list list-all local-update log push remote-update status update upgrade)' +) +arguments_list=( + '2:package:($(eval $installed))' +) +arguments_listall=( + '2:package:($(eval $all))' +) +arguments_notinstalled=( + '2:package:($(eval $notinstalled))' +) + +if [[ $CURRENT -ge 3 ]] { + case ${words[2]} in + changelog|check|delete|log|push|remove|status|upgrade) _arguments -s $arguments_list ;; + info) _arguments -s $arguments_listall ;; + add|install) _arguments -s $arguments_notinstalled ;; + esac +} else { + _arguments -s $arguments_action +} -- cgit v1.2.3