@ -7,8 +7,7 @@ function async_run()
} &
}
function git_prompt_dir( )
{
function git_prompt_dir( ) {
# assume the gitstatus.sh is in the same directory as this script
# code thanks to http://stackoverflow.com/questions/59895
if [ -z " $__GIT_PROMPT_DIR " ] ; then
@ -26,8 +25,7 @@ function echoc() {
echo -e " ${ 1 } $2 ${ ResetColor } " | sed 's/\\\]//g' | sed 's/\\\[//g'
}
function get_theme( )
{
function get_theme( ) {
local CUSTOM_THEME_FILE = " ${ HOME } /.git-prompt-colors.sh "
local DEFAULT_THEME_FILE = " ${ __GIT_PROMPT_DIR } /themes/Default.bgptheme "
@ -67,16 +65,15 @@ function get_theme()
fi
}
function git_prompt_load_theme( )
{
function git_prompt_load_theme( ) {
git_prompt_reset
get_theme
local DEFAULT_THEME_FILE = " ${ __GIT_PROMPT_DIR } /themes/Default.bgptheme "
source " ${ DEFAULT_THEME_FILE } "
source " ${ __GIT_PROMPT_THEME_FILE } "
}
function git_prompt_list_themes( )
{
function git_prompt_list_themes( ) {
local oldTheme
local oldThemeFile
@ -183,6 +180,7 @@ git_prompt_reset() {
for var in GIT_PROMPT_DIR __GIT_PROMPT_COLORS_FILE __PROMPT_COLORS_FILE __GIT_STATUS_CMD GIT_PROMPT_THEME_NAME; do
unset $var
done
unset -f prompt_callback
}
# gp_format_exit_status RETVAL
@ -203,8 +201,7 @@ gp_format_exit_status() {
fi
}
function git_prompt_config( )
{
function git_prompt_config( ) {
#Checking if root to change output
_isroot = false
[ [ $UID -eq 0 ] ] && _isroot = true
@ -225,7 +222,7 @@ function git_prompt_config()
git_prompt_load_theme
if [ "`type -t prompt_callback`" = 'function' ] ; then
if is_function prompt_callback ; then
prompt_callback = "prompt_callback"
else
prompt_callback = "prompt_callback_default"
@ -524,6 +521,12 @@ function updatePrompt() {
PS1 = " ${ NEW_PROMPT //_LAST_COMMAND_INDICATOR_/ ${ LAST_COMMAND_INDICATOR } } "
}
# Use exit status from declare command to determine whether input argument is a
# bash function
function is_function {
declare -Ff " $1 " >/dev/null;
}
function prompt_callback_default {
return
}