#!/bin/bash
########################################################
##
## This is the theme loader for bashish
##
########################################################

## load the theme defaults to memory
. $HOME/.bashish/bt/defaults/theme

## check if the theme for a given terminal exists,
## else load the standard theme (which may be branded)
test -d $HOME/.bashish/bt/prompt/ || {
	mkdir -p $HOME/.bashish/bt/prompt/
	cp $BASHISHDIR/bt/standard/theme $HOME/.bashish/bt/prompt/
}

typeset BASHISH_THEME

## load the prompt theme to memory
. $HOME/.bashish/bt/prompt/theme

## test if the loaded theme is a valid bashish2 theme, elsewise it will not 
## be loaded
test "x$BASHISH_THEME" != x &&{
	## this creates the function _bashish_theme_prompt() which calls
	## the selected bashish theme function (very fast)
	eval $(printf "function _bashish_theme_prompt { _bashish_theme_$BASHISH_THEME;}" )
}
## load the theme overrides to memory
. $HOME/.bashish/bt/overrides/theme

