diff options
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -239,6 +239,7 @@ currently available are: * **aws** - The current AWS profile, if active (more info below) * **context** - Your username and host (more info below) * **dir** - Your current working directory. +* **go_version** - Show the current GO version. * **history** - The command number for the current line. * **ip** - Shows the current IP address. * **load** - Your machines 5 minute load average and free RAM. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0c69a02e..fd0f4908 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -645,6 +645,16 @@ prompt_dir() { "$1_prompt_segment" "$0" "blue" "$DEFAULT_COLOR" "$(print_icon 'HOME_ICON')$current_path" } +# GO-prompt +prompt_go_version() { + local go_version + go_version=$(go version 2>&1 | grep -oe "^go[0-9.]*") + + if [[ -n "$go_version" ]]; then + "$1_prompt_segment" "$0" "green" "255" "$go_version" + fi +} + # Command number (in local history) prompt_history() { "$1_prompt_segment" "$0" "244" "$DEFAULT_COLOR" '%h' |