1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 05:40:07 +00:00

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.
This commit is contained in:
Dominik Ritter 2017-01-22 01:47:58 +01:00
parent 9ead1c1548
commit b8e18d7108

View file

@ -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'
}