From f057715a3049e79d991e593a0e965a0772b58fbc Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Sat, 19 Sep 2015 15:03:44 -0400 Subject: [PATCH 1/2] Use command -v instead of which. https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then --- bullet-train.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 441bf30..d32dcb9 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -342,14 +342,14 @@ prompt_ruby() { return fi - if which rvm-prompt &> /dev/null; then + if command -v rvm-prompt > /dev/null 2>&1; then if [[ ! -n $(rvm gemset list | grep "=> (default)") ]] then prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rvm-prompt i v g)" fi - elif which chruby &> /dev/null; then + elif command -v chruby > /dev/null 2>&1; then prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(chruby | sed -e 's/ \* //')" - elif which rbenv &> /dev/null; then + elif command -v rbenv > /dev/null 2>&1; then prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rbenv version | sed -e 's/ (set.*$//')" fi } From 3fbbce3bf8cdc0e09f5b71bcc776616b8bb36af4 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Sat, 19 Sep 2015 15:07:42 -0400 Subject: [PATCH 2/2] Fixup documentation for chruby --- README.md | 2 +- bullet-train.zsh-theme | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1df7fce..a67704b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ simplicity, showing information only when it's relevant. It currently shows: - Current Python virtualenv -- Current Ruby version using Rbenv; version and gemset when on RVM +- Current Ruby version using Rbenv or chruby; version and gemset when on RVM - Current Node.js version, through NVM - Git status - Timestamp diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index d32dcb9..4d62a35 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -337,6 +337,7 @@ prompt_dir() { # RUBY # RVM: only shows RUBY info if on a gemset that is not the default one # RBENV: shows current ruby version active in the shell +# CHRUBY: shows current ruby version active in the shell prompt_ruby() { if [[ $BULLETTRAIN_RUBY_SHOW == false ]] then return