]> arthur.barton.de Git - OhMyZshExtensions.git/commitdiff
Change plugins to not do anything if tool isn't available
authorAlexander Barton <alex@barton.de>
Mon, 8 Jun 2015 12:59:24 +0000 (14:59 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 8 Jun 2015 12:59:24 +0000 (14:59 +0200)
Don't even echo error messages, simply skip the plugin to do anything
when the respective tool(s) isn't available on the system.

plugins/5_dev_env/5_dev_env.plugin.zsh
plugins/boot2docker/boot2docker.plugin.zsh
plugins/keychain/keychain.plugin.zsh
plugins/thefuck/thefuck.plugin.zsh

index 2977ff87e2ead1d09d2e7e48382ceb86a19f963a..9e4cd26f62c606be52e7903796c5d231d55eaf64 100644 (file)
@@ -15,10 +15,14 @@ done
 unset ssh_wrapper
 
 # pip
-export PIP_REQUIRE_VIRTUALENV="true"
+if (( $+commands[pip] )); then
+       export PIP_REQUIRE_VIRTUALENV="true"
+fi
 
 # virtualenv[wrapper]
-export WORKON_HOME="$XDG_CACHE_HOME/virtualenvs"
-[ -d "$LOCAL_HOME/Develop" ] \
-        && export PROJECT_HOME="$LOCAL_HOME/Develop" \
-        || export PROJECT_HOME="$HOME/Develop"
+if (( $+commands[virtualenv] )); then
+       export WORKON_HOME="$XDG_CACHE_HOME/virtualenvs"
+       [ -d "$LOCAL_HOME/Develop" ] \
+               && export PROJECT_HOME="$LOCAL_HOME/Develop" \
+               || export PROJECT_HOME="$HOME/Develop"
+fi
index 9813acdb487943a97b10475169cf3d531f3fb281..8a63173ea4d893769fbfce2acb185391e72f790d 100644 (file)
@@ -1,8 +1,10 @@
 # boot2docker.plugin.zsh
 
-boot2docker status | fgrep "running" >/dev/null
-if [ $? -eq 0 ]; then
-       # boot2docker VM is running
-       eval `boot2docker shellinit 2>/dev/null`
-       DOCKER_HOST_IPA=${(z)${(s.:.)DOCKER_HOST#tcp://}[1]}
+if (( $+commands[boot2docker] )); then
+       boot2docker status | fgrep "running" >/dev/null
+       if [ $? -eq 0 ]; then
+               # boot2docker VM is running
+               eval `boot2docker shellinit 2>/dev/null`
+               DOCKER_HOST_IPA=${(z)${(s.:.)DOCKER_HOST#tcp://}[1]}
+       fi
 fi
index c1c6fbbc20a104e080340ce03e46eaaa53a2e9c5..e01f9ae6cf0881f4aae0ef6fb36ec9ec05f29a35 100644 (file)
@@ -1,3 +1,5 @@
 # keychain.plugin.zsh
 
-eval $(keychain --agents ssh --eval --quick --quiet)
+if (( $+commands[keychain] )); then
+       eval $(keychain --agents ssh --eval --quick --quiet)
+fi
index 4042544c7173256d1ec4c3e02f84621d6aa6812a..754d342168bb94615b0d5f50fa717736c30150ba 100644 (file)
@@ -1,3 +1,5 @@
 # thefuck.plugin.zsh
 
-alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
+if (( $+commands[thefuck] )); then
+       alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
+fi