Merge pull request #142 from dritter/rust_version

Added Rust version segment.
This commit is contained in:
Ben Hilburn 2015-11-16 09:10:58 -08:00
commit 9b067ea29c
2 changed files with 10 additions and 0 deletions

View File

@ -85,6 +85,7 @@ The segments that are currently available are:
* [ram](#ram) - Show free RAM and used Swap. * [ram](#ram) - Show free RAM and used Swap.
* [rbenv](#rbenv) - Ruby environment information (if one is active). * [rbenv](#rbenv) - Ruby environment information (if one is active).
* [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * [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. * [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_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. * **symphony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir.

View File

@ -479,6 +479,15 @@ prompt_rbenv() {
fi 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 # RSpec test ratio
prompt_rspec_stats() { prompt_rspec_stats() {
if [[ (-d app && -d spec) ]]; then if [[ (-d app && -d spec) ]]; then