Add prompt for current installed swift version

pull/22/head
Thomas Paul Mann 8 years ago
parent 1ff9da64d9
commit 21a5cbd988

@ -123,6 +123,8 @@ The segments that are currently available are:
* [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec.
* **Rust Segments:** * **Rust Segments:**
* `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg). * `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg).
* **Swift Segments:**
* `swift_version` - Show the version number of the installed Swift.
**Cloud Segments:** **Cloud Segments:**
* **AWS Segments:** * **AWS Segments:**

@ -72,6 +72,7 @@ case $POWERLEVEL9K_MODE in
VCS_SVN_ICON '(svn) ' VCS_SVN_ICON '(svn) '
RUST_ICON '' RUST_ICON ''
PYTHON_ICON $'\U1F40D' # 🐍 PYTHON_ICON $'\U1F40D' # 🐍
SWIFT_ICON ''
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -126,6 +127,7 @@ case $POWERLEVEL9K_MODE in
VCS_SVN_ICON '(svn) ' VCS_SVN_ICON '(svn) '
RUST_ICON $'\uE6A8' #  RUST_ICON $'\uE6A8' # 
PYTHON_ICON $'\U1F40D' # 🐍 PYTHON_ICON $'\U1F40D' # 🐍
SWIFT_ICON ''
) )
;; ;;
*) *)
@ -180,6 +182,7 @@ case $POWERLEVEL9K_MODE in
VCS_SVN_ICON '' VCS_SVN_ICON ''
RUST_ICON '' RUST_ICON ''
PYTHON_ICON '' PYTHON_ICON ''
SWIFT_ICON 'Swift'
) )
;; ;;
esac esac

@ -965,6 +965,17 @@ prompt_pyenv() {
fi 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 # Prompt processing and drawing
################################################################ ################################################################
@ -1091,4 +1102,3 @@ powerlevel9k_init() {
} }
powerlevel9k_init "$@" powerlevel9k_init "$@"

Loading…
Cancel
Save