aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-06-07 02:00:57 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-06-07 02:00:57 +0300
commitd3500625ca8646dfaaf91103cc5c33c74a958955 (patch)
treee7e57a2fe254a7a8b791b0c10f6c16abe6213338 /powerlevel9k.zsh-theme
parente763fa14b0f7117071072d4ed174cb639e76526a (diff)
parent4df61d923a4a0abc1384f7b59af72c3441016cb6 (diff)
Merge remote-tracking branch 'TheDan64/master' into staging_065
Conflicts were: - test/segments/rust_version.spec and powerlevel9k.zsh-theme. #826 removes grep from parsing the rust version on next; #703 changes color names.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme12
1 files changed, 7 insertions, 5 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 1f13ee5f..c0107eab 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1271,16 +1271,18 @@ prompt_root_indicator() {
################################################################
# Segment to display 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\\\-]*$')
-
+ local 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_version" 'RUST_ICON'
fi
}
-################################################################
-# Segment to display RSpec test ratio
+# RSpec test ratio
prompt_rspec_stats() {
if [[ (-d app && -d spec) ]]; then
local code_amount tests_amount