Merge pull request #260 from HaloZero/feature/theme-screenshots
Feature/theme screenshots
diff --git a/completion/available/homesick.completion.bash b/completion/available/homesick.completion.bash
new file mode 100644
index 0000000..d0ebbba
--- /dev/null
+++ b/completion/available/homesick.completion.bash
@@ -0,0 +1,60 @@
+# Bash completion script for homesick
+#
+# The homebrew bash completion script was used as inspiration.
+# Originally from https://github.com/liborw/homesick-completion
+
+_homesick_complete()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local options="--skip --force --pretend --quiet"
+ local actions="cd clone commit destroy diff generate help list open pull push rc show_path status symlink track unlink version"
+ local repos=$(\ls ~/.homesick/repos)
+
+ # Subcommand list
+ [[ ${COMP_CWORD} -eq 1 ]] && {
+ COMPREPLY=( $(compgen -W "${options} ${actions}" -- ${cur}) )
+ return
+ }
+
+ # Find the first non-switch word
+ local prev_index=1
+ local prev="${COMP_WORDS[prev_index]}"
+ while [[ $prev == -* ]]; do
+ prev_index=$((++prev_index))
+ prev="${COMP_WORDS[prev_index]}"
+ done
+
+ # Find the number of non-"--" commands
+ local num=0
+ for word in ${COMP_WORDS[@]}
+ do
+ if [[ $word != -* ]]; then
+ num=$((++num))
+ fi
+ done
+
+ case "$prev" in
+ # Commands that take a castle
+ cd|commit|destroy|diff|open|pull|push|rc|show_path|status|symlink|unlink)
+ COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) )
+ return
+ ;;
+ # Commands that take command
+ help)
+ COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) )
+ return
+ ;;
+ # Track command take file and repo
+ track)
+ if [[ "$num" -eq 2 ]]; then
+ COMPREPLY=( $(compgen -X -f ${cur}) )
+ elif [[ "$num" -ge 3 ]]; then
+ COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) )
+ fi
+ return
+ ;;
+ esac
+}
+
+complete -o bashdefault -o default -F _homesick_complete homesick
+
diff --git a/themes/base.theme.bash b/themes/base.theme.bash
index 9c5bedb..629e81d 100644
--- a/themes/base.theme.bash
+++ b/themes/base.theme.bash
@@ -132,7 +132,7 @@
function rbenv_version_prompt {
if which rbenv &> /dev/null; then
rbenv=$(rbenv version-name) || return
- $(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active) && rbenv="$rbenv@${gemset%% *}"
+ $(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}"
echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX"
fi
}
@@ -148,8 +148,13 @@
if declare -f -F chruby_auto &> /dev/null; then
chruby_auto
fi
- chruby=$(ruby --version | awk '{print $1, $2;}') || return
- echo -e "$CHRUBY_THEME_PROMPT_PREFIX$chruby$CHRUBY_THEME_PROMPT_SUFFIX"
+
+ ruby_version=$(ruby --version | awk '{print $1, $2;}') || return
+
+ if [[ ! $(chruby | grep '*') ]]; then
+ ruby_version="${ruby_version} (system)"
+ fi
+ echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}"
fi
}
@@ -188,3 +193,4 @@
function prompt_char {
scm_char
}
+