From 348eaca4a92d66b5454195bd6317d554db5656b2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 14 Sep 2008 21:40:06 +0200 Subject: More excessive completion --- bin/pkg | 2 +- provides/zsh/completions/_pkg | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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' } -- cgit v1.2.3