aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2017-01-22 03:47:58 +0300
committerDominik Ritter <dritter03@googlemail.com>2017-01-22 03:47:58 +0300
commitb8e18d710835ff4a3dbd7b19799b731d5930ccbd (patch)
tree80f9732b4c36fbdcd798e952d2677d92215ca873
parent9ead1c15480249b082bf93c59540f4a09fa44c8d (diff)
Fix swift segment
The regex for the swift segment matches too much. Here I simplified it to match the first number as this is probably the "main" version number.
-rwxr-xr-xpowerlevel9k.zsh-theme6
1 files changed, 2 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c3f2be74..dd904278 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1065,12 +1065,10 @@ prompt_pyenv() {
# Swift version
prompt_swift_version() {
- local swift_version=($(swift --version 2>/dev/null))
+ # Get the first number as this is probably the "main" version number..
+ local swift_version=$(swift --version 2>/dev/null | grep -o -E "[0-9.]+" | head -n 1)
[[ -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'
}