dotfiles/homedir/.bashrc

45 lines
721 B
Bash
Raw Normal View History

# vim: ft=sh
# Do nothing if not interactive
[[ "$PS1" ]] || return
# Modules
mpath=( $HOME/.config/bash.d )
function msg { printf '%s\n' "$*"; }
function err { printf '%s\n' "$*" >&2; }
function use {
while (( $# )); do
case $1 in
(-n) flag_nofail=1;;
(--) shift; break;;
(*) break;;
esac
shift
done
declare mname=$1
for p in "${mpath[@]}"; do
if [[ -f "$mpath/$mname" ]]; then
if source "$mpath/$mname"; then
msg "Loaded: $mname"
else
err "Something went wrong while loading $mname"
(( flag_nofail )) || return 1
fi
else
err "Module $mname not found"
(( flag_nofail )) || return 1
fi
done
return 0
}
use common
use colours
use config
use -n local
use prompt