Skip to content

Commit

Permalink
fix: Hardened the Docker context checking logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufkandemir committed Jul 13, 2020
1 parent e075f08 commit a853780
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sections/docker_context.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ spaceship_docker_context() {
# Docker contexts can be set using either the DOCKER_CONTEXT environment variable
# or the `docker context use` command. `docker context ls` will show the selected
# context in both cases. But we are not interested in the local "default" context.
docker_remote_context=$(docker context ls --format '{{if .Current}}{{if ne .Name "default"}}{{.Name}}{{end}}{{end}}' 2>/dev/null | tr -d '\n')
docker_remote_context=$(docker context ls --format '{{if .Current}}{{if ne .Name "default"}}{{.Name}}{{end}}{{end}}' 2>/dev/null)
[[ $? -ne 0 ]] && return

docker_remote_context=$(echo $docker_remote_context | tr -d '\n')
fi

[[ -z $docker_remote_context ]] && return
Expand Down

0 comments on commit a853780

Please sign in to comment.