summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-09-14 21:40:06 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-09-14 21:40:06 +0200
commit348eaca4a92d66b5454195bd6317d554db5656b2 (patch)
tree64172a96684506fa06cbd4da69e8684eacabe34f
parent6aba9ae67dd8868c9a060ebfa32f2bb19579596d (diff)
More excessive completion
-rwxr-xr-xbin/pkg2
-rw-r--r--provides/zsh/completions/_pkg18
2 files changed, 19 insertions, 1 deletions
diff --git a/bin/pkg b/bin/pkg
index 9b76318..5b6d4e1 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -636,7 +636,7 @@ case $1 in
status) wrap pkg_status "$2" "Checking package status" ;;
update) pkg_update ;;
upgrade) wrap pkg_upgrade "$2" "Looking for updates" ;;
- eval) eval $2 ;;
+ eval) shift; eval $* ;;
*) die "wait, what?\n" ;;
esac
diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg
index ef1da1e..0bd1b27 100644
--- a/provides/zsh/completions/_pkg
+++ b/provides/zsh/completions/_pkg
@@ -43,11 +43,29 @@ if (( CURRENT == 2 )) {
;;
eval)
_message 'shell code for evaluation'
+ _wanted function expl 'internal function' \
+ compadd $(grep -E '^\S*\s*\(\)\s*{' ~/bin/pkg | cut -d ' ' -f 1)
;;
*)
_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|)
+ _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)
+ ;;
+ esac
+ }
} else {
_message 'no more arguments'
}