summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-08 18:42:11 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-08 18:42:11 +0100
commita974aa305a8203d943d1395776c246f5b198a390 (patch)
treea8d3f1237965153d8b40d2973c39c0e37e46bd34
parent01a2107000e01d43cc618a3f93cd484a3e6361c3 (diff)
parentc9c202e3703e549242ff2bb828ae2113fb9f541c (diff)
Merge branch 'master' of ssh://aneurysm/home/derf/var/packages_root/core
-rw-r--r--man/1/pkg2
-rw-r--r--provides/zsh/completions/_pkg79
2 files changed, 44 insertions, 37 deletions
diff --git a/man/1/pkg b/man/1/pkg
index aa9db16..1cf823c 100644
--- a/man/1/pkg
+++ b/man/1/pkg
@@ -109,7 +109,7 @@ Automatically update the package list before doing certain actions
Append I<option> to the options checklinks is invoked with.
Only one option is allowed. To append more options, repeat the argument
-=item B<-p>, B<--package-dir> I<directory>
+=item B<-p>, B<--packagedir> I<directory>
Use I<directory> as local package directory
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'