summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDaniel Kolsoi <thadan64@gmail.com>2018-05-05 20:25:29 +0300
committerDaniel Kolsoi <thadan64@gmail.com>2018-05-05 20:25:29 +0300
commit5fd171c33421fcea2af034e7a0083235f005b401 (patch)
treef9d981d96bd9a1f98de7d8b663d9a4504b01e98d /powerlevel9k.zsh-theme
parent13b0e383a066c9c37d5cf71d4af521f9b73a173e (diff)
Fixed prompt_rust_version to avoid grep aliases
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme8
1 files 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