From dbb5bb1fb21dd8c77b9b9bef1998af110e431a22 Mon Sep 17 00:00:00 2001 From: Grant Stephens Date: Thu, 14 May 2020 10:08:10 +0100 Subject: [PATCH] Create go_prompt_info to add go version to prompts --- lib/golang.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/golang.zsh diff --git a/lib/golang.zsh b/lib/golang.zsh new file mode 100644 index 000000000..1596772ef --- /dev/null +++ b/lib/golang.zsh @@ -0,0 +1,7 @@ +# get the golang version +function go_prompt_info() { + local go_prompt + go_prompt=$(go version | awk '{ print substr($3, 3) }') + [[ "${go_prompt}x" == "x" ]] && return + echo "${ZSH_THEME_GO_PROMPT_PREFIX}${go_prompt}${ZSH_THEME_GO_PROMPT_SUFFIX}" +}