Skip to content

Commit

Permalink
Fix: Check for presence of go files
Browse files Browse the repository at this point in the history
Previously, the script only checked for a single .go file using the -f *.go(#qN) condition, resulting in a false negative when multiple .go files were present. This has been fixed by using an array to capture all matching .go files and checking the length of the array.
  • Loading branch information
adrian-lin-1-0-0 committed Jun 3, 2023
1 parent d60f62c commit c091e06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bullet-train.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@ prompt_perl() {
# Go
prompt_go() {
setopt extended_glob
if [[ (-f *.go(#qN) || -d Godeps || -f glide.yaml) ]]; then
go_files=( *.go(#qN) )

if [[ ($#go_files -gt 0 || -d Godeps || -f glide.yaml) ]]; then
if command -v go > /dev/null 2>&1; then
prompt_segment $BULLETTRAIN_GO_BG $BULLETTRAIN_GO_FG $BULLETTRAIN_GO_PREFIX" $(go version | grep --colour=never -oE '[[:digit:]].[[:digit:]]+')"
fi
Expand Down

0 comments on commit c091e06

Please sign in to comment.