mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 21:40:08 +00:00
speed up rust_version prompt
This commit is contained in:
parent
ee0d1bc452
commit
edc4e1375a
1 changed files with 4 additions and 10 deletions
|
@ -1392,16 +1392,10 @@ prompt_simple_dir() {
|
||||||
################################################################
|
################################################################
|
||||||
# Segment to display Rust version number
|
# Segment to display Rust version number
|
||||||
prompt_rust_version() {
|
prompt_rust_version() {
|
||||||
local rust_version
|
_p9k_cached_cmd_stdout rustc --version || return
|
||||||
rust_version=$(command rustc --version 2>/dev/null)
|
local v=${${_P9K_RETVAL#rustc }%% *}
|
||||||
# Remove "rustc " (including the whitespace) from the beginning
|
[[ -n $v ]] || return
|
||||||
# of the version string and remove everything after the next
|
"$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" 'RUST_ICON' 0 '' "${v//\%/%%}"
|
||||||
# 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# RSpec test ratio
|
# RSpec test ratio
|
||||||
|
|
Loading…
Reference in a new issue