aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorThomas Paul Mann <hi@thomaspaulmann.com>2016-12-01 23:21:05 +0300
committerThomas Paul Mann <hi@thomaspaulmann.com>2016-12-01 23:21:05 +0300
commit21a5cbd988531b5ca08afb6863f22e592170cdef (patch)
tree35a2c5b014dd13527c7e65a0ab6d7844801b3e4e /powerlevel9k.zsh-theme
parent1ff9da64d974265ce2f22bd1da4a47d0b8f7ca90 (diff)
Add prompt for current installed swift version
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme12
1 files changed, 11 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c06d1286..64662144 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -965,6 +965,17 @@ prompt_pyenv() {
fi
}
+# Swift version
+prompt_swift_version() {
+ local swift_version=($(swift --version 2>/dev/null))
+ [[ -z "${swift_version}" ]] && return
+
+ # Extract semantic version
+ swift_version=$(echo ${swift_version} | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/')
+
+ "$1_prompt_segment" "$0" "$2" "magenta" "white" "${swift_version}" 'SWIFT_ICON'
+}
+
################################################################
# Prompt processing and drawing
################################################################
@@ -1091,4 +1102,3 @@ powerlevel9k_init() {
}
powerlevel9k_init "$@"
-