# Bash Configuration

# Source shared configurations
if [ -f ~/.dotfiles/shared/exports ]; then
    source ~/.dotfiles/shared/exports
fi

if [ -f ~/.dotfiles/shared/aliases ]; then
    source ~/.dotfiles/shared/aliases
fi

if [ -f ~/.dotfiles/shared/functions ]; then
    source ~/.dotfiles/shared/functions
fi

if [ -f ~/.dotfiles/shared/sync ]; then
    source ~/.dotfiles/shared/sync
fi

if [ -f ~/.dotfiles/shared/completions ]; then
    source ~/.dotfiles/shared/completions
fi

if [ -f ~/.dotfiles/shared/prompt ]; then
    source ~/.dotfiles/shared/prompt
fi

# Bash-specific settings
shopt -s histappend
shopt -s checkwinsize
shopt -s cdspell
shopt -s dirspell
shopt -s nocaseglob

# History settings
HISTCONTROL=ignoreboth:erasedups
HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"

# Bash completion
if ! shopt -oq posix; then
    if [ -f /usr/share/bash-completion/bash_completion ]; then
        . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
    fi
fi

# Bash-specific prompt
if [[ -n $(git_branch 2>/dev/null) ]]; then
    PS1="\[${CYAN}\]\u@\h\[${RESET}\]:\[${BLUE}\]\w\[${RESET}\] \[${GREEN}\](\$(git_branch))\[${RED}\]\$(git_status)\[${RESET}\]\$ "
else
    PS1="\[${CYAN}\]\u@\h\[${RESET}\]:\[${BLUE}\]\w\[${RESET}\]\$ "
fi

# Source bash-specific aliases if they exist
if [ -f ~/.dotfiles/bash/.bash_aliases ]; then
    source ~/.dotfiles/bash/.bash_aliases
fi