1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-09-21 11:00:08 +00:00

Fixed prompt_rust_version to avoid grep aliases

This commit is contained in:
Daniel Kolsoi 2018-05-05 13:25:29 -04:00
parent 13b0e383a0
commit 5fd171c334

View file

@ -1104,10 +1104,14 @@ prompt_root_indicator() {
# Print Rust version number
prompt_rust_version() {
local rust_version
rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$')
rust_version=$(command rustc --version 2>&1)
# 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" "208" "$DEFAULT_COLOR" "Rust $rust_version" 'RUST_ICON'
"$1_prompt_segment" "$0" "$2" "208" "$DEFAULT_COLOR" "$rust_version" 'RUST_ICON'
fi
}
# RSpec test ratio