From 06f1d86ae2a407cf24a833ee892e6f9c748283ff Mon Sep 17 00:00:00 2001 From: Dan Kaplun Date: Mon, 5 Feb 2018 18:39:21 -0500 Subject: [PATCH] Add rust prompt (#261) Closes #258 --- bullet-train.zsh-theme | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 453d673..bd0a8c6 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -30,6 +30,7 @@ if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then nvm aws go + rust elixir git hg @@ -139,6 +140,17 @@ if [ ! -n "${BULLETTRAIN_GO_PREFIX+1}" ]; then BULLETTRAIN_GO_PREFIX="go" fi +# Rust +if [ ! -n "${BULLETTRAIN_RUST_BG+1}" ]; then + BULLETTRAIN_RUST_BG=black +fi +if [ ! -n "${BULLETTRAIN_RUST_FG+1}" ]; then + BULLETTRAIN_RUST_FG=white +fi +if [ ! -n "${BULLETTRAIN_RUST_PREFIX+1}" ]; then + BULLETTRAIN_RUST_PREFIX="🦀" +fi + # Kubernetes Context if [ ! -n "${BULLETTRAIN_KCTX_BG+1}" ]; then BULLETTRAIN_KCTX_BG=yellow @@ -529,6 +541,15 @@ prompt_go() { fi } +# Rust +prompt_rust() { + if [[ (-f Cargo.toml) ]]; then + if command -v rustc > /dev/null 2>&1; then + prompt_segment $BULLETTRAIN_RUST_BG $BULLETTRAIN_RUST_FG $BULLETTRAIN_RUST_PREFIX" $(rustc -V version | cut -d' ' -f2)" + fi + fi +} + # Kubernetes Context prompt_kctx() { if [[ ! -n $BULLETTRAIN_KCTX_KCONFIG ]]; then