diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-05-21 15:32:13 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-05-21 15:32:13 +0300 |
commit | edc4e1375aba17b4193d4d6445d2841258008cb7 (patch) | |
tree | 51bb17eccc4b91eaa503b3f1089a2bd0d4eb796b /powerlevel9k.zsh-theme | |
parent | ee0d1bc45264f35c0a3ae4b990f2b37cea969167 (diff) |
speed up rust_version prompt
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 047af4e5..9c531c42 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1392,16 +1392,10 @@ prompt_simple_dir() { ################################################################ # Segment to display Rust version number prompt_rust_version() { - local rust_version - rust_version=$(command rustc --version 2>/dev/null) - # Remove "rustc " (including the whitespace) from the beginning - # of the version string and remove everything after the next - # whitespace. This way we'll end up with only the version. - rust_version=${${rust_version/rustc /}%% *} - - if [[ -n "$rust_version" ]]; then - "$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" 'RUST_ICON' 0 '' "${rust_version//\%/%%}" - fi + _p9k_cached_cmd_stdout rustc --version || return + local v=${${_P9K_RETVAL#rustc }%% *} + [[ -n $v ]] || return + "$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" 'RUST_ICON' 0 '' "${v//\%/%%}" } # RSpec test ratio |