summaryrefslogtreecommitdiff
path: root/provides
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-09-02 22:43:38 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-09-02 22:43:38 +0200
commit281dfc7f62f347fc137190db6e736a07ecb490e6 (patch)
treedfc1a45f0664e5bb8794aac9327858acbb4cada2 /provides
parent0d4122def0c5bbd2de0e42a9e7b35ce20ffb1769 (diff)
zsh completion: Use cool zshcompsys features
Diffstat (limited to 'provides')
-rw-r--r--provides/zsh/completions/_envstore25
1 files changed, 20 insertions, 5 deletions
diff --git a/provides/zsh/completions/_envstore b/provides/zsh/completions/_envstore
index f75a223..1b8a862 100644
--- a/provides/zsh/completions/_envstore
+++ b/provides/zsh/completions/_envstore
@@ -5,8 +5,9 @@
## https://derf.homelinux.org/~derf/dotfiles/completion/_envstore
## see also: http://git.cloudconnected.org/?p=envstore.git;a=summary
-local arguments_action arguments_action_nofile
-local arguments_save arguments_rm arguments_eval
+local -a arguments_action arguments_action_nofile
+local -a arguments_save arguments_rm arguments_eval
+local lstate
arguments_action=(
'1:action:(clear eval rm save show)'
@@ -19,16 +20,16 @@ arguments_action_nofile=(
# Also, don't complete parameters marked 'special', since they're usually
# specific to the current shell
arguments_save=(
- '2:parameter:_parameters -g "(scalar|integer)*export"'
+ '2:parameter:->param'
)
arguments_rm=(
- '2:parameter:($(envstore eval -e | cut -d " " -f 2 | cut -d "=" -f 1))'
+ '2:saved parameter:->saved_param'
)
arguments_eval=(
'2::option:(-e)'
)
-if [[ $CURRENT -ge 3 ]] {
+if (( CURRENT >= 3 )) {
case ${words[2]} in
eval) _arguments -s $arguments_eval ;;
rm) _arguments -s $arguments_rm ;;
@@ -39,3 +40,17 @@ if [[ $CURRENT -ge 3 ]] {
} else {
_arguments -s $arguments_action_nofile
}
+
+while [[ -n $state ]]; do
+ lstate=$state
+ state=''
+ case $lstate in
+ param)
+ _parameters -g '(scalar|integer)*export'
+ ;;
+ saved_param)
+ _wanted parameter expl 'saved parameter' \
+ compadd $(envstore eval -e | cut -d ' ' -f 2 | cut -d '=' -f 1)
+ ;;
+ esac
+done