aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-01-24 18:11:02 +0300
committerGitHub <noreply@github.com>2017-01-24 18:11:02 +0300
commita58e8bdc8cf4c51c80dc9e63eef52e95214c54f2 (patch)
tree180633c64bad2435dba51c433fe052e80be76897
parenta95b4740a6226ed4d1e82305a6f05e59a03ae65e (diff)
parentb8e18d710835ff4a3dbd7b19799b731d5930ccbd (diff)
Merge pull request #379 from dritter/fix_swift_segment
Fix swift segment
-rwxr-xr-xpowerlevel9k.zsh-theme6
1 files changed, 2 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index f2e32582..f104b789 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1107,12 +1107,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'
}