# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=20000
HISTFILE=~/.bash_history

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
case "$TERM" in
    xterm*|cygwin*)
        if [ "$QLOUD_ENVIRONMENT" = "production" ]; then
            PS1="\[\033[1;32m\]$QLOUD_APPLICATION.\[\033[31m\]$QLOUD_ENVIRONMENT.\[\033[36m\]$QLOUD_COMPONENT\n\[\033[31m\]"'!! '"\[\033[39m\]\h\[$(tput sgr0)\]: \w# "
        else
            PS1="\[\033[32m\]$QLOUD_APPLICATION.\[\033[33m\]$QLOUD_ENVIRONMENT.\[\033[36m\]$QLOUD_COMPONENT\n\[\033[39m\]\h\[$(tput sgr0)\]: \w# "
        fi
        export PS1
        ;;
    dumb*)
        export PS1="$QLOUD_APPLICATION.$QLOUD_ENVIRONMENT.$QLOUD_COMPONENT.\h: \w# " ;;
    *)
        export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w# ' ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi
unset LC_CTYPE
