diff options
Diffstat (limited to 'dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/docker.zsh')
| m--------- | dot-oh-my-zsh | 0 | ||||
| -rw-r--r-- | dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/docker.zsh | 73 |
2 files changed, 0 insertions, 73 deletions
diff --git a/dot-oh-my-zsh b/dot-oh-my-zsh new file mode 160000 +Subproject 6fe84bf5c82da7b1f6d7c5ec3e5c447721ac8ce diff --git a/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/docker.zsh b/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/docker.zsh deleted file mode 100644 index 0aa3f450..00000000 --- a/dot-oh-my-zsh/custom/themes/spaceship-prompt/sections/docker.zsh +++ /dev/null @@ -1,73 +0,0 @@ -# -# Docker -# -# Docker automates the repetitive tasks of setting up development environments -# Link: https://www.docker.com - -# ------------------------------------------------------------------------------ -# Configuration -# ------------------------------------------------------------------------------ - -SPACESHIP_DOCKER_SHOW="${SPACESHIP_DOCKER_SHOW=true}" -SPACESHIP_DOCKER_PREFIX="${SPACESHIP_DOCKER_PREFIX="on "}" -SPACESHIP_DOCKER_SUFFIX="${SPACESHIP_DOCKER_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}" -SPACESHIP_DOCKER_SYMBOL="${SPACESHIP_DOCKER_SYMBOL="🐳 "}" -SPACESHIP_DOCKER_COLOR="${SPACESHIP_DOCKER_COLOR="cyan"}" -SPACESHIP_DOCKER_VERBOSE="${SPACESHIP_DOCKER_VERBOSE=false}" - -# ------------------------------------------------------------------------------ -# Dependencies -# ------------------------------------------------------------------------------ - -source "$SPACESHIP_ROOT/sections/docker_context.zsh" - -# ------------------------------------------------------------------------------ -# Section -# ------------------------------------------------------------------------------ - -# Show current Docker version and connected machine -spaceship_docker() { - [[ $SPACESHIP_DOCKER_SHOW == false ]] && return - - spaceship::exists docker || return - - # Better support for docker environment vars: https://docs.docker.com/compose/reference/envvars/ - local compose_exists=false - if [[ -n "$COMPOSE_FILE" ]]; then - # Use COMPOSE_PATH_SEPARATOR or colon as default - local separator=${COMPOSE_PATH_SEPARATOR:-":"} - - # COMPOSE_FILE may have several filenames separated by colon, test all of them - local filenames=("${(@ps/$separator/)COMPOSE_FILE}") - - for filename in $filenames; do - if [[ ! -f $filename ]]; then - compose_exists=false - break - fi - compose_exists=true - done - - # Must return if COMPOSE_FILE is present but invalid - [[ "$compose_exists" == false ]] && return - fi - - local docker_context="$(spaceship_docker_context)" - - # Show Docker status only for Docker-specific folders or when connected to external host - [[ "$compose_exists" == true || -f Dockerfile || -f docker-compose.yml || -f /.dockerenv || -n $docker_context ]] || return - - # if docker daemon isn't running you'll get an error saying it can't connect - # Note: Declaration and assignment is separated for correctly getting the exit code - local 'docker_version' - docker_version=$(docker version -f "{{.Server.Version}}" 2>/dev/null) - [[ $? -ne 0 || -z $docker_version ]] && return - - [[ $SPACESHIP_DOCKER_VERBOSE == false ]] && docker_version=${docker_version%-*} - - spaceship::section \ - "$SPACESHIP_DOCKER_COLOR" \ - "$SPACESHIP_DOCKER_PREFIX" \ - "${SPACESHIP_DOCKER_SYMBOL}v${docker_version}${docker_context}" \ - "$SPACESHIP_DOCKER_SUFFIX" -} |
