Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badboy/rustup-version-name
rustup toolchain override in your prompt
https://github.com/badboy/rustup-version-name
Last synced: 9 days ago
JSON representation
rustup toolchain override in your prompt
- Host: GitHub
- URL: https://github.com/badboy/rustup-version-name
- Owner: badboy
- License: mit
- Created: 2016-03-25T23:18:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-03T22:55:46.000Z (almost 7 years ago)
- Last Synced: 2024-12-24T02:01:35.755Z (12 days ago)
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rustup-version-name
Show the used Rust toolchain version name for the current working directory.
If you use [rustup](https://github.com/rust-lang-nursery/rustup.rs)
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.## Install
```
cargo install --git https://github.com/badboy/rustup-version-name
```## Use
```
rustup-version-name
```## Use in shell prompt
Add the following function to your `.bashrc` or `.zshrc`:
```shell
__rust_prompt() {
local rustp=$(rustup-version-name)
if [ -n "$rustp" ] && [ "$rustp" != "default" ]
then
echo " $rustp"
fi
}
```Add the function to your `PS1`:
```shell
PS1="[%~\$(__rust_prompt)%# "
```Restart your shell and your done.
## Todo
* Search for override in upper directory.
## License
[MIT](LICENSE)