Crates.io | rustup-version-name |
lib.rs | rustup-version-name |
version | 0.2.1 |
source | src |
created_at | 2016-06-24 15:04:47.033399 |
updated_at | 2016-12-13 16:51:41.191245 |
description | rustup toolchain override in your prompt |
homepage | https://github.com/badboy/rustup-version-name |
repository | https://github.com/badboy/rustup-version-name |
max_upload_size | |
id | 5479 |
size | 6,892 |
Show the used Rust toolchain version name for the current working directory.
If you use rustup you may have toolchain overrides for certain directories. Sometimes it is good to see which one that is. Put it in your prompt and it is there when you need to know.
cargo install --git https://github.com/badboy/rustup-version-name
rustup-version-name
Add the following function to your .bashrc
or .zshrc
:
__rust_prompt() {
local rustp=$(rustup-version-name)
if [ -n "$rustp" ] && [ "$rustp" != "default" ]
then
echo " $rustp"
fi
}
Add the function to your PS1
:
PS1="[%~\$(__rust_prompt)%# "
Restart your shell and your done.