#632: Indicate `Rust` or `(rust)` for rust_version segment only if icon is unavailable

pull/22/head
Chris Chou 7 years ago
parent 688f6203b4
commit 5657fe6ac7

@ -77,7 +77,7 @@ case $POWERLEVEL9K_MODE in
VCS_GIT_GITLAB_ICON $'\uE20E ' # VCS_GIT_GITLAB_ICON $'\uE20E ' #
VCS_HG_ICON $'\uE1C3 ' #  VCS_HG_ICON $'\uE1C3 ' # 
VCS_SVN_ICON '(svn) ' VCS_SVN_ICON '(svn) '
RUST_ICON '' RUST_ICON '(rust)'
PYTHON_ICON $'\ue63c' #  PYTHON_ICON $'\ue63c' # 
SWIFT_ICON '' SWIFT_ICON ''
GO_ICON '' GO_ICON ''
@ -290,7 +290,7 @@ case $POWERLEVEL9K_MODE in
VCS_GIT_GITLAB_ICON '' VCS_GIT_GITLAB_ICON ''
VCS_HG_ICON '' VCS_HG_ICON ''
VCS_SVN_ICON '' VCS_SVN_ICON ''
RUST_ICON '' RUST_ICON 'Rust'
PYTHON_ICON '' PYTHON_ICON ''
SWIFT_ICON 'Swift' SWIFT_ICON 'Swift'
GO_ICON 'Go' GO_ICON 'Go'

@ -1097,7 +1097,7 @@ prompt_rust_version() {
rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$') rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$')
if [[ -n "$rust_version" ]]; then if [[ -n "$rust_version" ]]; then
"$1_prompt_segment" "$0" "$2" "208" "$DEFAULT_COLOR" "Rust $rust_version" 'RUST_ICON' "$1_prompt_segment" "$0" "$2" "208" "$DEFAULT_COLOR" "$rust_version" 'RUST_ICON'
fi fi
} }
# RSpec test ratio # RSpec test ratio

@ -19,7 +19,7 @@ function testRust() {
alias rustc=mockRust alias rustc=mockRust
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version) POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
assertEquals "%K{208} %F{black}Rust 0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)" assertEquals "%K{208} %F{black%}Rust%f %F{black}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias rustc unalias rustc

Loading…
Cancel
Save