themes: Make PROMPT_COMMAND usage consistent for reloading OMB

This commit is contained in:
Koichi Murase
2022-01-11 12:40:43 +09:00
parent c3bcc5c6d2
commit 7f420263b2
65 changed files with 184 additions and 141 deletions

View File

@@ -26,7 +26,7 @@ shopt -s histverify
shopt -s lithist
# Record each line as it gets issued
PROMPT_COMMAND='history -a'
_omb_util_add_prompt_command 'history -a'
# Huge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000

View File

@@ -32,3 +32,12 @@ _omb_util_defun_deprecate 20000 e_warning _omb_log_warning
_omb_util_defun_deprecate 20000 e_underline _omb_log_underline
_omb_util_defun_deprecate 20000 e_bold _omb_log_bold
_omb_util_defun_deprecate 20000 e_note _omb_log_note
# themes/*
_omb_util_defun_deprecate 20000 prompt_command _omb_theme_PROMPT_COMMAND
_omb_util_defun_deprecate 20000 prompt _omb_theme_PROMPT_COMMAND
_omb_util_defun_deprecate 20000 prompt_setter _omb_theme_PROMPT_COMMAND
_omb_util_defun_deprecate 20000 pure_setter _omb_theme_PROMPT_COMMAND # pure, gallifrey
_omb_util_defun_deprecate 20000 dulcie_setter _omb_theme_PROMPT_COMMAND # dulcie
_omb_util_defun_deprecate 20000 _brainy_setter _omb_theme_PROMPT_COMMAND # brainy
_omb_util_defun_deprecate 20000 set_bash_prompt _omb_theme_PROMPT_COMMAND # agnoster

View File

@@ -75,6 +75,10 @@
_omb_version=10000
_omb_bash_version=$((BASH_VERSINFO[0] * 10000 + BASH_VERSINFO[1] * 100 + BASH_VERSINFO[2]))
function _omb_util_setexit {
return "$1"
}
function _omb_util_defun_print {
builtin eval -- "function $1 { local $3; $2 \"\$@\" && printf '%s\n' \"\${$3}\"; }"
}
@@ -246,27 +250,54 @@ else
}
fi
_omb_util_prompt_command=()
_omb_util_prompt_command_hook() {
local status=$? lastarg=$_ hook
for hook in "${_omb_util_prompt_command[@]}"; do
_omb_util_setexit "$status" "$lastarg"
eval -- "$hook"
done
}
: "${_omb_util_prompt_command_setup=}"
_omb_util_add_prompt_command() {
local other
for other in "${_omb_util_prompt_command[@]}"; do
[[ $1 == "$other" ]] && return 0
done
_omb_util_prompt_command+=("$1")
if [[ ! $_omb_util_prompt_command_setup ]]; then
_omb_util_prompt_command_setup=1
local hook=_omb_util_prompt_command_hook
# See if we need to use the overriden version
if _omb_util_function_exists append_prompt_command_override; then
append_prompt_command_override "$hook"
return
fi
# Set OS dependent exact match regular expression
local prompt_re
if [[ $OSTYPE == darwin* ]]; then
# macOS
prompt_re='[[:<:]]'$1'[[:>:]]'
prompt_re='[[:<:]]'$hook'[[:>:]]'
else
# Linux, FreeBSD, etc.
prompt_re='\<'$1'\>'
prompt_re='\<'$hook'\>'
fi
[[ $PROMPT_COMMAND =~ $prompt_re ]] && return 0
# See if we need to use the overriden version
if _omb_util_function_exists append_prompt_command_override; then
append_prompt_command_override "$1"
return
fi
if [[ $PROMPT_COMMAND =~ $prompt_re ]]; then
return
if ((_omb_bash_version >= 50100)); then
local other
for other in "${PROMPT_COMMAND[@]}"; do
[[ $hook == "$other" ]] && return 0
done
PROMPT_COMMAND+=("$hook")
else
PROMPT_COMMAND="$1${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
PROMPT_COMMAND="$hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
fi
fi
}

View File

@@ -10,8 +10,8 @@ GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
# Nicely formatted terminal prompt
function prompt_command(){
function _omb_theme_PROMPT_COMMAND(){
export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -303,7 +303,7 @@ __command_rprompt() {
done
[ -z "$times" ] || printf "%${n}s$times\\r" ''
}
# PROMPT_COMMAND=__command_rprompt
# _omb_util_add_prompt_command __command_rprompt
# this doens't wrap code in \[ \]
ansi_r() {
@@ -414,7 +414,7 @@ build_prompt() {
# this doesn't work... new model: create a prompt via a PR variable and
# use that.
set_bash_prompt() {
_omb_theme_PROMPT_COMMAND() {
RETVAL=$?
PR=""
PRIGHT=""
@@ -426,5 +426,4 @@ set_bash_prompt() {
# PS1='\[$(tput sc; printf "%*s" $COLUMNS "$PRIGHT"; tput rc)\]'$PR
PS1=$PR
}
PROMPT_COMMAND=set_bash_prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -33,10 +33,10 @@ else
RESET="\033[m"
fi
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]@ \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\[$SCM_THEME_PROMPT_PREFIX\]$(clock_prompt) \[$PURPLE\]\$(scm_prompt_info) \n\$ \[$RESET\]"
}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${white}"}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -12,11 +12,11 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
RVM_THEME_PROMPT_PREFIX="|"
RVM_THEME_PROMPT_SUFFIX="|"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(_omb_prompt_print_ruby_env) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
#PS1="\n${purple}\h: ${reset_color} ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} "
#PS1="\n${cyan}\h: ${reset_color} ${yellow}\w\n${red}$(scm_char)${red}$(scm_prompt_info) ${green}→${reset_color} "
PS1="\n${cyan}\h: ${reset_color} ${yellow}\w ${green}$(scm_prompt_info)\n${reset_color}"
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -66,7 +66,7 @@ __ps_time() {
echo "$(clock_prompt)${normal}\n"
}
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
ps_reboot="${bright_yellow}$(show_reboot_required)${normal}\n"
ps_username="$(set_user_color)\u${normal}"
@@ -98,4 +98,4 @@ SCM_GIT_CHAR="${green}±${light_grey}"
SCM_SVN_CHAR="${bold_cyan}${light_grey}"
SCM_HG_CHAR="${bold_red}${light_grey}"
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -11,9 +11,9 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
CONDAENV_THEME_PROMPT_SUFFIX="|"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(_omb_prompt_print_ruby_env) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
PS1="\n${yellow}$(python_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}${reset_color} "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -21,7 +21,7 @@ __bobby_clock() {
fi
}
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(_omb_prompt_print_ruby_env) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
PS1="\n$(battery_char) $(__bobby_clock)${yellow}$(_omb_prompt_print_ruby_env) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_prompt_char_info) ${green}${reset_color} "
}
@@ -31,4 +31,4 @@ THEME_CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$red"}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$bold_cyan"}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%Y-%m-%d %H:%M:%S"}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -285,11 +285,11 @@ __brainy_ps2() {
printf "%s%s%s" "${color}" "${__BRAINY_PROMPT_CHAR_PS2} " "${normal}"
}
_brainy_prompt() {
_omb_theme_PROMPT_COMMAND() {
exitcode="$?"
PS1="$(__brainy_ps1)"
PS2="$(__brainy_ps2)"
}
_omb_util_add_prompt_command _brainy_prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -26,11 +26,11 @@ scm_prompt() {
fi
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} "
}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue$background_white"}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-" %H:%M:%S"}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -1,10 +1,10 @@
#! bash oh-my-bash.module
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ";
}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -10,7 +10,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="${bold_red}✗"
export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi
@@ -18,4 +18,4 @@ function prompt_command() {
RPROMPT='[\t]'
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -17,7 +17,7 @@ function git_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
}
function prompt() {
function _omb_theme_PROMPT_COMMAND() {
local return_status=""
local ruby="${red}$(_omb_prompt_print_ruby_env)${reset_color}"
local user_host="${green}\h @ \w${reset_color}"
@@ -28,4 +28,4 @@ function prompt() {
PS1="\n${user_host}${prompt_symbol}${ruby} ${git_branch} ${return_status}\n${prompt_char}"
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -62,10 +62,10 @@ function winname {
# PROMPT OUTPUT ===============================================================
# Displays the current prompt
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${bold_red}\u${normal}${icon_host}${bold_cyan}\h${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white}$(scm_prompt_info)${normal}\n${icon_end}"
PS2="${icon_end}"
}
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -91,7 +91,7 @@ safe_battery_charge() {
}
# -------------------------------------------------------------- PROMPT OUTPUT
prompt() {
_omb_theme_PROMPT_COMMAND() {
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
local SAVE_CURSOR='\033[s'
local RESTORE_CURSOR='\033[u'
@@ -126,4 +126,4 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
}
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -39,7 +39,7 @@ doubletime_scm_prompt() {
fi
}
function prompt_setter() {
function _omb_theme_PROMPT_COMMAND() {
# Save history
history -a
history -c
@@ -51,7 +51,7 @@ $(doubletime_scm_prompt)$reset_color $ "
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
git_prompt_status() {
local git_status_output

View File

@@ -2,7 +2,7 @@
source "$OSH/themes/doubletime/doubletime.theme.sh"
function prompt_setter() {
function _omb_theme_PROMPT_COMMAND() {
# Save history
history -a
history -c
@@ -15,4 +15,4 @@ $(doubletime_scm_prompt)$reset_color $ "
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -2,7 +2,7 @@
source "$OSH/themes/doubletime/doubletime.theme.sh"
function prompt_setter() {
function _omb_theme_PROMPT_COMMAND() {
# Save history
history -a
history -c
@@ -15,4 +15,4 @@ $(doubletime_scm_prompt)$reset_color $ "
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -23,7 +23,7 @@ dulcie_background() {
echo -en "\[\e[48;5;${1}m\]"
}
dulcie_prompt() {
_omb_theme_PROMPT_COMMAND() {
color_user_root=$(dulcie_color 169)
color_user_nonroot="${green}"
color_host_local=$(dulcie_color 230)
@@ -95,4 +95,4 @@ dulcie_prompt() {
PS1="${PS1}${DULCIE_PROMPTCHAR} "
}
_omb_util_add_prompt_command dulcie_prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -17,8 +17,8 @@ last_two_dirs() {
pwd|rev|awk -F / '{print $1,$2}'|rev|sed s_\ _/_|sed "s|$(sed 's,\/,,'<<<$HOME)|~|g"
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
PS1="${yellow}# ${reset_color}$(last_two_dirs)$(scm_prompt_info)${reset_color}$(venv)${reset_color} ${cyan}\n> ${reset_color}"
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -33,10 +33,10 @@ __emperor_clock() {
clock_prompt
}
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\n$(__emperor_clock)${purple}\h ${reset_color}in ${prompt_color}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}${reset_color} "
}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H "}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -9,8 +9,8 @@ GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓"
GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\n${yellow}$(_omb_prompt_print_ruby_env) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}${reset_color} "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -37,7 +37,7 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
VIRTUALENV_THEME_PROMPT_PREFIX='('
VIRTUALENV_THEME_PROMPT_SUFFIX=') '
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
# This needs to be first to save last command return code
local RC="$?"
@@ -58,4 +58,4 @@ function prompt_command() {
PS1="$(clock_prompt)$python_venv${hostname} ${bold_cyan}\W $(scm_prompt_char_info)${ret_status}${normal}"
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -24,7 +24,7 @@ scm_prompt() {
fi
}
pure_prompt() {
_omb_theme_PROMPT_COMMAND() {
ps_host="${green}\h${normal}";
ps_user_mark="${bold}\$${normal}";
ps_root_mark="${normal}§"
@@ -39,4 +39,4 @@ pure_prompt() {
esac
}
_omb_util_add_prompt_command pure_prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -31,7 +31,7 @@ export SCM_GIT_SHOW_MINIMAL_INFO=true
export VIRTUALENV_THEME_PROMPT_PREFIX='('
export VIRTUALENV_THEME_PROMPT_SUFFIX=') '
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
# This needs to be first to save last command return code
local RC="$?"
@@ -52,4 +52,4 @@ function prompt_command() {
PS1="$python_venv${hostname} ${bold_cyan}\w $(scm_prompt_char_info)${ret_status}${normal}"
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -11,7 +11,7 @@ _omb_theme_half_way_prompt_scm() {
fi
}
prompt_command() {
_omb_theme_PROMPT_COMMAND() {
local ps_username="${purple}\u${normal}"
local ps_path="${green}\w${normal}"
local ps_user_mark="${orange}λ${normal}"
@@ -19,4 +19,4 @@ prompt_command() {
PS1="$ps_username in $ps_path$(_omb_theme_half_way_prompt_scm) $ps_user_mark "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -181,7 +181,7 @@ function limited_pwd() {
}
# Displays the current prompt
function prompt() {
function _omb_theme_PROMPT_COMMAND() {
local UC=$USER_COLOR
((UID == 0)) && UC=$SUPERUSER_COLOR
@@ -194,4 +194,4 @@ function prompt() {
PS4='+ '
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -33,7 +33,7 @@ function git_prompt_info {
}
LAST_PROMPT=""
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
local new_PS1="${bold_cyan}$(scm_char)${yellow}$(_omb_prompt_print_ruby_env)${green}\w $(scm_prompt_info)"
local new_prompt=$(PS1="$new_PS1" "$BASH" --norc -i </dev/null 2>&1 | sed -n '${s/^\(.*\)exit$/\1/p;}')
@@ -48,4 +48,4 @@ function prompt_command() {
PS1="${new_PS1}${green}${wrap_char}${reset_color} "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -7,7 +7,7 @@
_omb_module_require plugin:battery
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
local status=$?
# added TITLEBAR for updating the tab and window titles with the pwd
@@ -40,4 +40,4 @@ SCM_THEME_PROMPT_PREFIX="${bold_cyan}("
SCM_THEME_PROMPT_SUFFIX="${bold_cyan})${reset_color}"
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -13,7 +13,7 @@ GIT_THEME_PROMPT_SUFFIX="${normal})"
RVM_THEME_PROMPT_PREFIX=""
RVM_THEME_PROMPT_SUFFIX=""
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
dtime="$(clock_prompt)"
user_host="${green}\u@${cyan}\h${normal}"
current_dir="${bold_blue}\w${normal}"
@@ -30,4 +30,4 @@ function prompt_command() {
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$yellow"}
THEME_CLOCK_FORMAT=${THEME_TIME_FORMAT:-"%I:%M:%S "}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -99,7 +99,7 @@ my_ve(){
echo "";
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
my_ps_host="$BOLD$ORANGE\h${normal}";
# yes, these are the the same for now ...
@@ -128,4 +128,4 @@ PS2="└─▪ "
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -17,7 +17,7 @@ function git_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
}
function prompt() {
function _omb_theme_PROMPT_COMMAND() {
local return_status=""
local ruby="${red}$(_omb_prompt_print_ruby_env)${reset_color}"
local user_host="${green}\h${reset_color}"
@@ -32,4 +32,4 @@ function prompt() {
PS1="\n${n_commands} ${user_host} ${prompt_symbol} ${ruby} ${open}${current_path}${git_branch}${close}${return_status}\n${prompt_char}"
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -5,8 +5,8 @@ SCM_THEME_PROMPT_SUFFIX="${cyan})"
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${green}"
prompt() {
_omb_theme_PROMPT_COMMAND() {
PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} "
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -36,7 +36,7 @@ modern_scm_prompt() {
fi
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
if [ $? -ne 0 ]
then
# Yes, the indenting on these is weird, but it has to be like
@@ -54,4 +54,4 @@ PS2="└─▪ "
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -36,7 +36,7 @@ modern_scm_prompt() {
fi
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
if [ $? -ne 0 ]
then
# Yes, the indenting on these is weird, but it has to be like
@@ -54,4 +54,4 @@ PS2="└─▪ "
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -15,7 +15,7 @@ case $TERM in
;;
esac
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="${TITLEBAR}[\u@\h \W $(scm_prompt_info)]\$ "
}
@@ -26,4 +26,4 @@ SCM_THEME_PROMPT_PREFIX="${green}("
SCM_THEME_PROMPT_SUFFIX="${green})${reset_color}"
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -5,11 +5,11 @@
# host directory (branch*)»
# for example:
# ananas ~/Code/bash-it/themes (master*)»
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="${bold_blue}[$(hostname)]${normal} \w${normal} ${bold_white}[$(git_prompt_info)]${normal}» "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
## git-theme
# feel free to change git chars.

View File

@@ -23,7 +23,7 @@ function prompt_end() {
echo -e "$PROMPT_END"
}
prompt_setter() {
_omb_theme_PROMPT_COMMAND() {
local exit_status=$?
if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN
else PROMPT_END=$PROMPT_END_DIRTY
@@ -37,7 +37,7 @@ prompt_setter() {
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"

View File

@@ -90,7 +90,7 @@ function prompt_end() {
echo -e "$PROMPT_END"
}
prompt_setter() {
_omb_theme_PROMPT_COMMAND() {
local exit_status=$?
if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN
else PROMPT_END=$PROMPT_END_DIRTY
@@ -104,7 +104,7 @@ prompt_setter() {
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"

View File

@@ -1,6 +1,6 @@
#! bash oh-my-bash.module
prompt_setter() {
_omb_theme_PROMPT_COMMAND() {
# Save history
history -a
history -c
@@ -10,7 +10,7 @@ prompt_setter() {
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
SCM_THEME_PROMPT_DIRTY=" ✗"
SCM_THEME_PROMPT_CLEAN=" ✓"

View File

@@ -50,4 +50,5 @@ IN_VIM_THEME_PROMPT_TEXT="vim"
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby cwd"}
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}
_omb_util_add_prompt_command __powerline_prompt_command
_omb_theme_PROMPT_COMMAND() { __powerline_prompt_command "$@"; }
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -49,4 +49,5 @@ IN_VIM_THEME_PROMPT_TEXT="vim"
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
_omb_util_add_prompt_command __powerline_prompt_command
_omb_theme_PROMPT_COMMAND() { __powerline_prompt_command "$@"; }
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -45,4 +45,5 @@ IN_VIM_THEME_PROMPT_TEXT="vim"
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
_omb_util_add_prompt_command __powerline_prompt_command
_omb_theme_PROMPT_COMMAND() { __powerline_prompt_command "$@"; }
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -48,4 +48,5 @@ IN_VIM_THEME_PROMPT_TEXT="vim"
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
_omb_util_add_prompt_command __powerline_prompt_command
_omb_theme_PROMPT_COMMAND() { __powerline_prompt_command "$@"; }
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -1,11 +1,11 @@
#! bash oh-my-bash.module
# based of the candy theme, but minimized by odbol
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="$(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ";
}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -15,8 +15,8 @@ function git_prompt_info {
echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_SUFFIX"
}
function prompt() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\h: \W $(scm_prompt_info)${reset_color} $ "
}
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -24,7 +24,7 @@ scm_prompt() {
fi
}
pure_prompt() {
_omb_theme_PROMPT_COMMAND() {
ps_host="${bold_blue}\h${normal}";
ps_user="${green}\u${normal}";
ps_user_mark="${green} $ ${normal}";
@@ -41,4 +41,4 @@ pure_prompt() {
esac
}
_omb_util_add_prompt_command pure_prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -13,9 +13,9 @@ GIT_THEME_PROMPT_SUFFIX=" ${reset_color})"
STATUS_THEME_PROMPT_BAD="${bold_red}${reset_color}${normal} "
STATUS_THEME_PROMPT_OK="${bold_green}${reset_color}${normal} "
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
local ret_status="$( [ $? -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
PS1="\n${blue}\w $(scm_prompt_info)\n${ret_status} "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -5,7 +5,7 @@
# ± ~/path/to (branch ✓) $
# in glorious red / blue / yellow color scheme
prompt_setter() {
_omb_theme_PROMPT_COMMAND() {
# Save history
history -a
history -c
@@ -18,7 +18,7 @@ prompt_setter() {
PS4='+ '
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
SCM_NONE_CHAR='·'
SCM_THEME_PROMPT_DIRTY=" ${red}"

View File

@@ -174,7 +174,7 @@ prompt_git() {
}
# -------------------------------------------------------------- PROMPT OUTPUT
prompt() {
_omb_theme_PROMPT_COMMAND() {
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
local SAVE_CURSOR='\033[s'
local RESTORE_CURSOR='\033[u'
@@ -211,4 +211,4 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
}
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -76,7 +76,7 @@ my_prompt_char() {
fi
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
my_ps_host="${STRING_COLOR}\h${normal}";
my_ps_user="${STRING_COLOR}\u${normal}";
@@ -98,4 +98,4 @@ PS2="└─$(my_prompt_char)"
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -6,7 +6,7 @@ export GIT_PS1_SHOWSTASHSTATE=true
export PROMPT_DIRTRIM=3
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
if [[ ${EUID} == 0 ]] ; then
PS1="[$(clock_prompt)]${yellow}[${red}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ "
else
@@ -14,4 +14,4 @@ function prompt_command() {
fi
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -40,8 +40,8 @@ parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -12,7 +12,7 @@ case $TERM in
;;
esac
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="${TITLEBAR}${orange}${reset_color}${green}\w${bold_blue}\[\$(scm_prompt_info)\]${normal} "
}
@@ -22,4 +22,4 @@ SCM_THEME_PROMPT_CLEAN=" ✓"
SCM_THEME_PROMPT_PREFIX="("
SCM_THEME_PROMPT_SUFFIX=")"
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -13,9 +13,9 @@ function _omb_theme_sirup_rubygem {
[[ $full ]] && echo "$full"
}
function prompt_command {
function _omb_theme_PROMPT_COMMAND {
# Check http://github.com/Sirupsen/dotfiles for screenshot
PS1="$blue\W/$bold_blue$(_omb_theme_sirup_rubygem)$bold_green$(__git_ps1 " (%s)") ${normal}$ "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -54,7 +54,7 @@ modern_scm_prompt() {
fi
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
case $HOSTNAME in
"clappy"* ) my_ps_host="${green}\h${normal}";
@@ -84,4 +84,4 @@ PS2="> "
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -18,8 +18,8 @@ case $TERM in
;;
esac
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PROMPT='${green}\u${normal}@${green}\h${normal}:${blue}\w${normal}${red}$(prompt_char)$(git_prompt_info)${normal}\$ '
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -17,7 +17,7 @@ __tonka_clock() {
fi
}
prompt_setter() {
_omb_theme_PROMPT_COMMAND() {
# Named "Tonka" because of the colour scheme
local WHITE="\[\033[1;37m\]"
@@ -49,7 +49,7 @@ PS2="$LIGHT_BLUE-$YELLOW-$YELLOW-$NO_COLOUR "
}
_omb_util_add_prompt_command prompt_setter
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
THEME_SHOW_CLOCK=${THEME_SHOW_CLOCK:-"true"}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"\[\033[1;33m\]"}

View File

@@ -6,8 +6,8 @@ SCM_THEME_PROMPT_DIRTY=" ${red}✗"
SCM_THEME_PROMPT_CLEAN=" ${green}"
SCM_GIT_SHOW_DETAILS="false"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="${yellow}\u${normal}${cyan}@\h${normal}${purple} ${normal}${green}\w${normal}$(scm_prompt_info)> "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -13,8 +13,8 @@ RVM_THEME_PROMPT_SUFFIX="|"
VIRTUALENV_THEME_PROMPT_PREFIX='|'
VIRTUALENV_THEME_PROMPT_SUFFIX='|'
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
PS1="\n${green}$(_omb_prompt_print_python_venv)${red}$(_omb_prompt_print_ruby_env) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}${white} "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -12,7 +12,7 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
RVM_THEME_PROMPT_PREFIX="|"
RVM_THEME_PROMPT_SUFFIX="|"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
if [ $? -eq 0 ]; then
status=❤️
else
@@ -23,4 +23,4 @@ function prompt_command() {
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"}
PROMPT_COMMAND=prompt_command;
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -13,7 +13,7 @@ GIT_THEME_PROMPT_SUFFIX=""
export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS="no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;34:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:"
function prompt_command() {
function _omb_theme_PROMPT_COMMAND() {
## look-a-like
# user:host:pwd git-branch(*)$
# for example:
@@ -21,4 +21,4 @@ function prompt_command() {
PS1="${no_color}\u:$(hostname)${normal}:${bold_yellow}\W/${normal} $(git_prompt_info)${reset_color}$ "
}
_omb_util_add_prompt_command prompt_command
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

View File

@@ -66,7 +66,7 @@ my_ve(){
echo "";
}
prompt() {
_omb_theme_PROMPT_COMMAND() {
my_ps_host="${green}\h${normal}";
# yes, these are the the same for now ...
@@ -95,4 +95,4 @@ PS2="└─▪ "
_omb_util_add_prompt_command prompt
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND