Skip to content

Commit

Permalink
Check for go files presence to display go prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
gillchristian committed Jan 20, 2017
1 parent 459f8dc commit 9575bc9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions spaceship.zsh
Expand Up @@ -52,6 +52,7 @@ SPACESHIP_SWIFT_SYMBOL="${SPACESHIP_SWIFT_SYMBOL:-🐦}"

# GOLANG
SPACESHIP_GOLANG_SHOW="${SPACESHIP_GOLANG_SHOW:-true}"
SPACESHIP_GOLANG_SHOW_ALWAYS="${SPACESHIP_GOLANG_SHOW_ALWAYS:-false}"
SPACESHIP_GOLANG_SYMBOL="${SPACESHIP_GOLANG_SYMBOL:-🐹}"

# XCODE
Expand Down Expand Up @@ -320,13 +321,16 @@ spaceship_golang_version() {
[[ $SPACESHIP_GOLANG_SHOW == false ]] && return

$(command -v go > /dev/null 2>&1) || return

# Do not show GOLANG prefix if prefixes are disabled
[[ ${SPACESHIP_PREFIX_SHOW} == true ]] && echo -n "%B${SPACESHIP_PREFIX_GOLANG}%b" || echo -n ' '

echo -n "%{$fg_bold[cyan]%}"
echo -n "${SPACESHIP_GOLANG_SYMBOL} v$(go version | grep --colour=never -oE '[[:digit:]].[[:digit:]]')"
echo -n "%{$reset_color%}"

local gofiles=`ls -1 *.go 2>/dev/null | wc -l`
if [ $SPACESHIP_GOLANG_SHOW_ALWAYS == true -o $gofiles != 0 -o -d Godeps -o -f glide.yaml ]; then
# Do not show GOLANG prefix if prefixes are disabled
[[ ${SPACESHIP_PREFIX_SHOW} == true ]] && echo -n "%B${SPACESHIP_PREFIX_GOLANG}%b" || echo -n ' '

echo -n "%{$fg_bold[cyan]%}"
echo -n "${SPACESHIP_GOLANG_SYMBOL} v$(go version | grep --colour=never -oE '[[:digit:]].[[:digit:]]')"
echo -n "%{$reset_color%}"
fi
}

# Xcode
Expand Down

0 comments on commit 9575bc9

Please sign in to comment.