summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2015-11-16 20:10:58 +0300
committerBen Hilburn <bhilburn@gmail.com>2015-11-16 20:10:58 +0300
commit9b067ea29c1231ee147476a4ebd012b0722a067d (patch)
tree377331a732bcb40ce8ee36d1190fd0e0cf41837f
parent77c31e17d143c8fb2a872dd27d26616fecdb69ec (diff)
parent37113bc120dc212ab8fd5cb300ad3d7b167527b9 (diff)
Merge pull request #142 from dritter/rust_version
Added Rust version segment.
-rw-r--r--README.md1
-rwxr-xr-xpowerlevel9k.zsh-theme9
2 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index f811169e..4d225d14 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,7 @@ The segments that are currently available are:
* [ram](#ram) - Show free RAM and used Swap.
* [rbenv](#rbenv) - Ruby environment information (if one is active).
* [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec.
+* **rust_version** - Display the current rust version.
* [status](#status) - The return code of the previous command, and status of background jobs.
* [symphony2_tests](#symphony2_tests) - Show a ratio of test classes vs code classes for Symfony2.
* **symphony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir.
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 9b0f31bd..0707276d 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -479,6 +479,15 @@ prompt_rbenv() {
fi
}
+# 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\\\-]*$')
+
+ if [[ -n "$rust_version" ]]; then
+ "$1_prompt_segment" "$0" "208" "$DEFAULT_COLOR" "Rust $rust_version"
+ fi
+}
# RSpec test ratio
prompt_rspec_stats() {
if [[ (-d app && -d spec) ]]; then