#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return
APPNAME=$(hostname)
PROGRAMMER="TheeMahn"
BUILDDATE=$(date)
VERSION="2.1.0"
DOMAIN="rambooter.com"
WEBSITE="http://${DOMAIN}/"
EMAIL="<${PROGRAMMER}@${DOMAIN}>"
if [[ -f "ultimate-common" ]]; then
	source ultimate-common
elif [[ -f "/usr/share/ultimate_edition/ultimate-common" ]]; then
	source /usr/share/ultimate_edition/ultimate-common
else
	echo "No Ultimate Edition common source. Please install ultimate-edition-common."
	exit 1;
fi
#export BASHMATIC_HOME="${HOME}/.bashmatic"
#export PATH="${BASHMATIC_HOME}/bin:${PATH}"
#[[ -f ~/.bashmatic/init.sh ]] && source ~/.bashmatic/init.sh
Center "Welcome to ${APPNAME}"
Timer Start "Logging in to ${APPNAME}"
FullBar
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
ex () {
	if [ -f "${1}" ] ; then
		case "${1}" in
			*.tar.bz2) tar xjf "${1}"		;;
			*.tar.gz) tar xzf "${1}"	 ;;
			*.bz2) bunzip2 "${1}"	   ;;
			*.rar) rar x "${1}"	 ;;
			*.gz) gunzip "${1}"	 ;;
			*.tar) tar xf "${1}"		;;
			*.tbz2) tar xjf "${1}"	  ;;
			*.tgz) tar xzf "${1}"	   ;;
			*.zip) unzip "${1}"	 ;;
			*.Z) uncompress "${1}"  ;;
			*.7z) 7z x "${1}"	;;
			*) echo "${1} cannot be extracted via extract()" ;;
		esac
	else
		echo "${1} is not a valid file"
	fi
}
#Pacman shortcuts
alias installed="pacman -Qi | grep -E '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less"
alias p="pacman"
alias pQ="pacman -Q"
alias pqs="pacman -Qs"
alias pqi="pacman -Qi"
alias pS="sudo pacman -S"
#alias installall="pacman -Ss ^${1} | cut -d ' ' -f 1 | xargs sudo pacman --noconfirm -Syuu"
alias install="sudo pacman --noconfirm -S ${1}"
alias upgrade="sudo pacman -Syuu"
alias psi="pacman -Si"
alias pR="sudo pacman -R"
alias prc="sudo pacman -Rc"
alias prs="sudo pacman -Rs"
alias prsc="sudo pacman -Rsc"
alias pA="sudo pacman -A"
alias pU="sudo pacman -U"
alias pO="sudo pacman-optimize"
alias ug="sudo grub-mkconfig -o /boot/grub/grub.cfg"
alias mkinit="sudo mkinitcpio -P"
alias findtext="grep -Rnw . -e ${1}"
alias is="LC_ALL=C.UTF-8 pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | LC_ALL=C.UTF-8 sort -h"
INSTALLED=$(type -p expac)
if [[ "${INSTALLED}" ]]; then
	alias is='expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <({ pacman -Qqg xorg; expac -l '\n' '%E' base; } | sort -u)) | sort -n'
fi
alias irfs="sudo lsinitcpio -a /boot/initramfs-linux*.img"
alias irfsx="sudo lsinitcpio -x /boot/initramfs-linux*.img ."
alias initbak="sudo cp /boot/initramfs-linux*.img /media/Source/"
#Colorful pacman -Ss output
pss () {
       echo -e "$(pacman -Ss $@ | sed
       -e 's#current/.*#\033[1;31m&\033[0;37m#g'
       -e 's#extra/.*#\033[0;32m&\033[0;37m#g'
       -e 's#community/.*#\033[1;35m&\033[0;37m#g'
       -e 's#^.*/.* [0-9].*#\033[0;36m&\033[0;37m#g' )"
}
VersionDump
Information
SysInfo
NetInfo
Timer Stop "Logging in to ${APPNAME}"
FullBar
