From 5fd171c33421fcea2af034e7a0083235f005b401 Mon Sep 17 00:00:00 2001 From: Daniel Kolsoi Date: Sat, 5 May 2018 13:25:29 -0400 Subject: [PATCH] Fixed prompt_rust_version to avoid grep aliases --- powerlevel9k.zsh-theme | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0e09ef03..c901103d 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -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