diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-08-19 20:28:38 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-08-19 20:28:38 +0200 |
commit | 8a8c2199e83698ca477a60a7fd9a0e4737b4d033 (patch) | |
tree | 17743c625b1f6d860800f4dc15aeb425bd74c305 /provides | |
parent | ac3d4092ffbdf5591f7ee1c76438ab0f108d7631 (diff) |
zsh completion: Only complete clear etc. if something was saved in before
Diffstat (limited to 'provides')
-rw-r--r-- | provides/zsh/completions/_envstore | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/provides/zsh/completions/_envstore b/provides/zsh/completions/_envstore index 1158c2c..65c85c1 100644 --- a/provides/zsh/completions/_envstore +++ b/provides/zsh/completions/_envstore @@ -5,16 +5,20 @@ ## https://derf.homelinux.org/~derf/dotfiles/completion/_envstore ## see also: http://git.cloudconnected.org/?p=envstore.git;a=summary -local arguments_action arguments_save arguments_rm arguments_eval +local arguments_action arguments_action_nofile +local arguments_save arguments_rm arguments_eval arguments_action=( '1:action:(clear eval rm save show)' ) +arguments_action_nofile=( + '1:action:(save)' +) arguments_save=( - '2:variable:_parameters -g \*-export' + '2:parameter:_parameters -g \*-export' ) arguments_rm=( - '2:variable:($(envstore eval -e | cut -d " " -f 2 | cut -d "=" -f 1))' + '2:parameter:($(envstore eval -e | cut -d " " -f 2 | cut -d "=" -f 1))' ) arguments_eval=( '2::option:(-e)' @@ -26,6 +30,8 @@ if [[ $CURRENT -ge 3 ]] { rm) _arguments -s $arguments_rm ;; save) _arguments -s $arguments_save ;; esac -} else { +} elif [[ -r /tmp/envstore-$UID ]] { _arguments -s $arguments_action +} else { + _arguments -s $arguments_action_nofile } |