diff options
-rw-r--r-- | antigenrc | 1 | ||||
-rwxr-xr-x | docker-machine/install | 30 | ||||
-rwxr-xr-x | docker-machine/uninstall | 5 | ||||
-rw-r--r-- | sh/aliases.sh | 32 |
4 files changed, 50 insertions, 18 deletions
@@ -12,5 +12,6 @@ antigen bundles <<EOBUNDLES zsh-users/zsh-autosuggestions memark/zsh-dotnet-completion https://gitlab.com/noammac/dotfiles plugins/cht.sh + https://github.com/leonhartX/docker-machine-zsh-completion EOBUNDLES antigen apply diff --git a/docker-machine/install b/docker-machine/install new file mode 100755 index 0000000..5bbd82c --- /dev/null +++ b/docker-machine/install @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +SCRIPT="docker-machine-installer" + +if docker compose >&/dev/null; then + current_version=0.0.0 + echo "$SCRIPT: not installed" +else + current_version=$(docker-machine --version >&/dev/null | grep -oE '[0-9]+.[0-9\.]+') + echo "$SCRIPT: found $current_version" +fi + +# version=$(curl -s "https://api.github.com/repos/docker/machine/releases" | grep -oE '[0-9]+.[0-9\.]+') +version="0.16.2" + +if [[ "$version" == "$current_version" ]]; then + echo "$SCRIPT: up-to-date" +else + echo "$SCRIPT: new version found $version" + echo "$SCRIPT: downloading..." + + arch="$(uname -s)-$(uname -m)" + echo "https://github.com/docker/machine/releases/download/v$version/docker-machine-$arch" + + curl -L "https://github.com/docker/machine/releases/download/v$version/docker-machine-$arch" >/tmp/docker-machine && + chmod +x /tmp/docker-machine && + cp /tmp/docker-machine "${HOME}/.local/bin" + + echo "$SCRIPT: installed" +fi diff --git a/docker-machine/uninstall b/docker-machine/uninstall new file mode 100755 index 0000000..5375ce8 --- /dev/null +++ b/docker-machine/uninstall @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if rm -f /usr/local/bin/docker-machine; then + echo "compose-cli: uninstalled" +fi diff --git a/sh/aliases.sh b/sh/aliases.sh index f617fae..5004d5d 100644 --- a/sh/aliases.sh +++ b/sh/aliases.sh @@ -14,21 +14,17 @@ alias ipa="ip -s -c -h a" alias untar="tar -zxvf " alias update="sudo apt update && apt list --upgradable" alias upgrade="sudo apt upgrade -y" - -if command -v docker &>/dev/null; then - if [ -f ~/.docker/cli-plugins/docker-compose ]; then - alias dc="docker compose" - else - alias dc="docker-compose" - fi - alias dexec="docker exec -it" - alias dps="docker ps" - alias dce="dc exec" - alias dcps="dc ps" - alias dcls="dc ls" - alias dcdn="dc down" - alias dcup="dc up" - alias dcupd="dc up -d" - alias dcl="dc logs" - alias dclf="dc logs -f" -fi +alias cht="cht.sh" +alias dc="docker-compose" +docker compose >&/dev/null && alias dc="docker compose" +alias dm="docker-machine" +alias dexec="docker exec -it" +alias dps="docker ps" +alias dce="dc exec" +alias dcps="dc ps" +alias dcls="dc ls" +alias dcdn="dc down" +alias dcup="dc up" +alias dcupd="dc up -d" +alias dcl="dc logs" +alias dclf="dc logs -f" |