From b209d4449fab4cb78bae1b8b047ede5dc88f3c4f Mon Sep 17 00:00:00 2001 From: Lukasz Olszewski Date: Mon, 30 Jan 2017 14:32:55 +0100 Subject: [PATCH] added validation - docker engine exist --- mage2docker.plugin.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mage2docker.plugin.zsh b/mage2docker.plugin.zsh index 943fe9f..94c24a4 100644 --- a/mage2docker.plugin.zsh +++ b/mage2docker.plugin.zsh @@ -2,7 +2,6 @@ # # Plugin for Oh-My-Zsh - _docker_get_container_name () { docker ps | awk '{if(NR>1) print $NF}' } @@ -16,6 +15,7 @@ _mage2docker_mage() { } _mage2docker() { + local curcontext="$curcontext" state line typeset -A opt_args @@ -80,6 +80,11 @@ mage2docker () { } -compdef _mage2docker mage2docker +if type "docker" > /dev/null; then + + compdef _mage2docker mage2docker + alias m2d='mage2docker' -alias m2d='mage2docker' +else + echo "mage2docker - docker is not installed" +fi