浏览代码

Fix aws.plugins.zsh check rule

Check _aws_zsh_completer_path had exist or not
Superbil 10 年之前
父节点
当前提交
7931d5ce1a
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      plugins/aws/aws.plugin.zsh

+ 5 - 2
plugins/aws/aws.plugin.zsh

@@ -22,7 +22,10 @@ function aws_profiles {
 compctl -K aws_profiles asp
 compctl -K aws_profiles asp
 
 
 if _homebrew-installed && _awscli-homebrew-installed ; then
 if _homebrew-installed && _awscli-homebrew-installed ; then
-  source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
+  _aws_zsh_completer_path=$(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
 else
 else
-  source `which aws_zsh_completer.sh`
+  _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
 fi
 fi
+
+[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
+unset _aws_zsh_completer_path