#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls -G'
PS1='[\u@\h \W]\$ '

if [ -x "$(command -v direnv)" ]; then
    eval "$(direnv hook bash)"
fi

alias edit="$(which emacsclient) "

if [ -d "$HOME/.cache/wal" ]; then
    (cat "$HOME/.cache/wal/sequences" &)
fi

if [ -f ~/.bashrc.local ]; then
    source ~/.bashrc.local
fi

alias k=kubectl
alias kctx=kubectx
alias kns=kubens
alias watch='watch '

# Setup pyenv (https://github.com/pyenv/pyenv)
if command -v pyenv 1>/dev/null 2>&1; then
    export PYENV_ROOT="$HOME/.pyenv"
    eval "$(pyenv init -)"
fi
if command -v pyenv virtualenv 1>/dev/null 2>&1; then
    eval "$(pyenv virtualenv-init -)"
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"                   # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# https://docs.python-guide.org/dev/pip-virtualenv/
export PIP_REQUIRE_VIRTUALENV=true

export PIPENV_VERBOSITY=-1
export PIPENV_DONT_LOAD_ENV=1
export PIPENV_MAX_DEPTH=20

export GPG_TTY=$(tty)
if [ -x "$(command -v gpg-connect-agent)" ]; then
    gpg-connect-agent updatestartuptty /bye > /dev/null
fi

export BASH_SILENCE_DEPRECATION_WARNING=1

# AWS
export KOPS_STATE_STORE=s3://lola-kops-cluster-state

# bash prompt
if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
    __GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
    source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
else
    parse_git_branch() {
        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
    }
    export PS1="\[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "
fi

# plaid-cli
PLAID_CLIENT_ID="$(pass plaid-cli-client-id)"
PLAID_SECRET="$(pass plaid-cli-development-secret)"
PLAID_ENVIRONMENT=development