From 5d314bec8e6465feca3a757d4e8a9a626d322561 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 30 Sep 2015 20:12:47 +0200 Subject: [PATCH 1/3] Add segment for rust version. --- powerlevel9k.zsh-theme | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index b4f993ec..982024f5 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_version" + fi +} # RSpec test ratio prompt_rspec_stats() { if [[ (-d app && -d spec) ]]; then From c81863e23429aeadb70a89764c489d0728fd59c3 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 1 Oct 2015 17:35:11 +0200 Subject: [PATCH 2/3] Add an Identifier to version. --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 982024f5..b8a53822 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -485,7 +485,7 @@ prompt_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_version" + "$1_prompt_segment" "$0" "208" "$DEFAULT_COLOR" "Rust $rust_version" fi } # RSpec test ratio From 37113bc120dc212ab8fd5cb300ad3d7b167527b9 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 15 Nov 2015 23:53:10 +0100 Subject: [PATCH 3/3] Added documentation. --- README.md | 1 + 1 file changed, 1 insertion(+) 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.