# GNU Health BASH environment
# 2013-2014 Luis Falcon <falcon@gnu.org>

# File Editor 

export EDITOR=vi

if ! type $EDITOR >/dev/null ; then
    echo "$EDITOR not found" 
fi

# Get the most current Tryton server version
# It should only be one trytond, but just in case..
TRYTOND=`ls -1d $HOME/gnuhealth/tryton/server/trytond-* | egrep -o "trytond-[0-9\.]+.[0-9\.]+.[0-9\.]+" | sort -V | tail -1`

# Add PYTHONPATH environment variable 
export PYTHONPATH=${HOME}/gnuhealth/tryton/server/${TRYTOND}

# Aliases
alias cdlogs='cd $HOME/gnuhealth/logs'
alias cdexe='cd $HOME/gnuhealth/tryton/server/${TRYTOND}/bin'
alias cdconf='cd $HOME/gnuhealth/tryton/server/${TRYTOND}/etc'
alias cdmods='cd $HOME/gnuhealth/tryton/server/modules'
alias editconf='${EDITOR} $HOME/gnuhealth/tryton/server/${TRYTOND}/etc/trytond.conf'

alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'

#GNU HEALTH version
export GNUHEALTH_VERSION=`cat $HOME/gnuhealth/version`

# Commented to be compatible with FreeBSD
# alias ls='ls --color=auto'

#Prompt

PS1="\[\e[32;2m\]\u@\h:\[\e[30;0m\]\w $ \[\e[0m\]"
