caiogondim / bullet-train.zsh

:bullettrain_side: An oh-my-zsh shell theme based on the Powerline Vim plugin
MIT License
2.82k stars 382 forks source link

fix bug in golang version argument #273

Closed Wingless-Archangel closed 6 years ago

Wingless-Archangel commented 6 years ago

the current version is 1.10.1 which will cause the new line in the matching pattern as shown below.

$ go version | grep -oE "[[:digit:]].[[:digit:]]"
1.1
0.1

to fix this issue, changing to pure cut command in the request.

Wingless-Archangel commented 6 years ago

Thank you! It’s just quick and dirty one though.

On Fri, Apr 6, 2018 at 20:53 Salmanul Farzy notifications@github.com wrote:

@salmanulfarzy commented on this pull request.

Consider using awk instead of two cut commands.

In bullet-train.zsh-theme https://github.com/caiogondim/bullet-train.zsh/pull/273#discussion_r179734779 :

@@ -536,7 +535,7 @@ prompt_go() { setopt extended_glob if [[ (-f *.go(#qN) || -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:]]')"
  • prompt_segment $BULLETTRAIN_GO_BG $BULLETTRAIN_GO_FG $BULLETTRAIN_GO_PREFIX" $(go version |cut -d ' ' -f3 | cut -c '3-')"

We could get go version with only awk

go version | awk '{print substr($3, 3)}'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/caiogondim/bullet-train.zsh/pull/273#pullrequestreview-110035401, or mute the thread https://github.com/notifications/unsubscribe-auth/ADo_ceVSJApifOeC1OaGSI_fPTZaLhcFks5tl1cdgaJpZM4TJawn .

Wingless-Archangel commented 6 years ago

Duplicate with #264