aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-09-21 19:27:03 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-09-21 19:27:03 +0300
commit1a5edebae76586361258ab68cb3f26148dfe026e (patch)
tree31bc7f8c882d5f86421fd0202e13e7593295b282
parent6cec4ce40059fe4b1450794f20f7ab5fbda0735d (diff)
Added a segment that shows the current GO version number.
-rw-r--r--README.md1
-rw-r--r--powerlevel9k.zsh-theme10
2 files changed, 11 insertions, 0 deletions
diff --git a/README.md b/README.md
index 98033e79..6dfd7240 100644
--- a/README.md
+++ b/README.md
@@ -235,6 +235,7 @@ currently available are:
* **context** - Your username and host (more info below)
* **vi_mode** - Vi editing mode (NORMAL|INSERT).
* **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 86fc2c42..413a61f5 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -608,6 +608,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'