diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-07-24 17:08:45 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-07-24 17:08:45 +0200 |
commit | 47f113c41bcea82a17d13d7af1091097152b0ceb (patch) | |
tree | f1d27a34c4d5c4ab255afe413de8d9cc8ae615e9 | |
parent | 22afe41c9cc059baec7588d5af9aabf26577b6ce (diff) |
etc/completions/_envstore: Only complete vars for save, complete saved vars for rm
-rw-r--r-- | etc/completions/_envstore | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/etc/completions/_envstore b/etc/completions/_envstore index 0be548e..2f9c18d 100644 --- a/etc/completions/_envstore +++ b/etc/completions/_envstore @@ -1,11 +1,27 @@ #compdef envstore ## vim:ft=zsh -local arguments +local arguments_action arguments_save arguments_rm arguments_eval -arguments=( - ':action:(clear eval rm save show)' - ':variable:_parameters -g \*-export' +arguments_action=( + '1:action:(clear eval rm save show)' +) +arguments_save=( + '2:variable:_parameters -g \*-export' +) +arguments_rm=( + '2:variable:($(envstore eval -e | cut -d " " -f 2 | cut -d "=" -f 1))' +) +arguments_eval=( + '2::option:(-e)' ) -_arguments -s $arguments +if [[ $CURRENT -ge 3 ]] { + case ${words[2]} in + eval) _arguments -s $arguments_eval ;; + rm) _arguments -s $arguments_rm ;; + save) _arguments -s $arguments_save ;; + esac +} else { + _arguments -s $arguments_action +} |