From 337caf1a503e25abb6ad4e588eb6eee812bc35fc Mon Sep 17 00:00:00 2001 From: James Whisnant Date: Fri, 18 Dec 2015 18:12:07 -0500 Subject: [PATCH 1/3] Add support to zork them for crouton debian chroot and virtualenv Adds support for a crouton debian chroot and python virtualenvwrapper to the zork theme. --- themes/zork/zork.theme.bash | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index c71f1344..5c9becda 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -46,6 +46,27 @@ modern_scm_prompt() { fi } +# show chroot if exist +chroot(){ + if [ -n "$debian_chroot" ] + then + my_ps_chroot="\[\033[01;36m\]\$debian_chroot\[\033[00m\]"; + echo "($my_ps_chroot)"; + fi + } + +# show virtualenvwrapper +my_ve(){ + if [ -n "$VIRTUAL_ENV" ] + then + my_ps_ve="\[\033[01;35m\]\$ve\[\033[00m\]"; + echo "($my_ps_ve)"; + fi + echo ""; + } + + + prompt() { case $HOSTNAME in @@ -61,12 +82,17 @@ prompt() { my_ps_root="\[\033[01;31m\]\u\[\033[00m\]"; my_ps_path="\[\033[01;36m\]\w\[\033[00m\]"; + if [ -n "$VIRTUAL_ENV" ] + then + ve=`basename $VIRTUAL_ENV`; + fi + # nice prompt case "`id -u`" in - 0) PS1="${TITLEBAR}┌─[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) └─▪ " ;; - *) PS1="${TITLEBAR}┌─[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) └─▪ " ;; esac From ddba9555c7dbc04bb76689922461425b286a876c Mon Sep 17 00:00:00 2001 From: James Whisnant Date: Sat, 19 Dec 2015 23:28:23 -0500 Subject: [PATCH 2/3] use words instead of escape codes, some code cleanup --- themes/zork/zork.theme.bash | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 5c9becda..456ac0de 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -50,7 +50,7 @@ modern_scm_prompt() { chroot(){ if [ -n "$debian_chroot" ] then - my_ps_chroot="\[\033[01;36m\]\$debian_chroot\[\033[00m\]"; + my_ps_chroot="${bold_cyan}$debian_chroot${normal}"; echo "($my_ps_chroot)"; fi } @@ -59,28 +59,20 @@ chroot(){ my_ve(){ if [ -n "$VIRTUAL_ENV" ] then - my_ps_ve="\[\033[01;35m\]\$ve\[\033[00m\]"; + my_ps_ve="${bold_purple}$ve${normal}"; echo "($my_ps_ve)"; fi echo ""; } - - prompt() { - case $HOSTNAME in - "zork"* ) my_ps_host="${green}\h${normal}"; - ;; - "pandora") my_ps_host="${red}\h${normal}"; - ;; - * ) my_ps_host="${green}\h${normal}"; - ;; - esac - - my_ps_user="\[\033[01;32m\]\u\[\033[00m\]"; - my_ps_root="\[\033[01;31m\]\u\[\033[00m\]"; - my_ps_path="\[\033[01;36m\]\w\[\033[00m\]"; + my_ps_host="${green}\h${normal}"; + # yes, these are the the same for now ... + my_ps_host_root="${green}\h${normal}"; + + my_ps_user="${green}\h${normal}" + my_ps_root="${bold_red}\u${normal}"; if [ -n "$VIRTUAL_ENV" ] then @@ -89,7 +81,7 @@ prompt() { # nice prompt case "`id -u`" in - 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) └─▪ " ;; *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) From fbd0a33cd1c5dc0a8ed6c7c2ed221fde9e6f346d Mon Sep 17 00:00:00 2001 From: James Whisnant Date: Sat, 19 Dec 2015 23:37:12 -0500 Subject: [PATCH 3/3] fix normal user username --- themes/zork/zork.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 456ac0de..c022a408 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -71,7 +71,7 @@ prompt() { # yes, these are the the same for now ... my_ps_host_root="${green}\h${normal}"; - my_ps_user="${green}\h${normal}" + my_ps_user="${bold_green}\u${normal}" my_ps_root="${bold_red}\u${normal}"; if [ -n "$VIRTUAL_ENV" ]