#!/bin/sh

PS1='$(prompt) \$ '

# this is a story all about how
# history control in bash sucks, wow
HISTFILE=~/.sh_eternal_history
HISTSIZE=
HISTCONTROL=ignoredups:erasedups
shopt -s histappend

# extend pa for git stuffs
# meh i don't like this at all tbh
pa() {
    case $1 in
        g)
            cd "${PA_DIR:=${XDG_DATA_HOME:=$HOME/.local/share}/pa}"
            git pull
            git add --all
            git commit -m '*'
            git push
            cd -
        ;;

        *)
            command pa "$@"
        ;;
    esac
}

if ls --version 2>&1 | grep -iE "gnu|busybox" > /dev/null; then
    alias ls='ls --color=auto '
fi

if [ -z "${SSH_AGENT_PID}" ]
then
    if ! [ -e /tmp/ssh-agent-$USER ]
    then
        ssh-agent 2>/dev/null >/tmp/ssh-agent-$USER
    fi
    . /tmp/ssh-agent-$USER >/dev/null
fi

if [ "$TERM" = "foot" ]; then
  alias ssh='TERM=xterm-256color ssh'
fi

# simple prompt
# for demo purposes mostly
alias sp="export PS1='$ '"
