diff --git a/dotfiles/lib/shellenv.sh b/dotfiles/lib/shellenv.sh index 32a9353f..9f2356a2 100644 --- a/dotfiles/lib/shellenv.sh +++ b/dotfiles/lib/shellenv.sh @@ -1,5 +1,9 @@ -source ~/.lib/shellrc/functions.sh -source ~/.lib/shellrc/emacs.sh +source ~/.lib/shellenv/functions.sh + +for filename in ~/.lib/shellenv/*; do + source $filename +done + function add_to_front_of_path { export PATH=$@:$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||") } @@ -34,6 +38,6 @@ add_to_back_of_path "/usr/local/sbin" # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" -function shellrc { +function with_shellrc { zsh -c "source ~/.zshrc && ""$@" } diff --git a/dotfiles/lib/shellrc/emacs.sh b/dotfiles/lib/shellenv/emacs.sh similarity index 100% rename from dotfiles/lib/shellrc/emacs.sh rename to dotfiles/lib/shellenv/emacs.sh diff --git a/dotfiles/lib/shellrc/functions.sh b/dotfiles/lib/shellenv/functions.sh similarity index 98% rename from dotfiles/lib/shellrc/functions.sh rename to dotfiles/lib/shellenv/functions.sh index bcb706ff..28fa98dc 100644 --- a/dotfiles/lib/shellrc/functions.sh +++ b/dotfiles/lib/shellenv/functions.sh @@ -1,3 +1,9 @@ +shell_contains () { + local e + for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done + return 1 +} + function dotfiles_directory() { echo $(dirname `readlink -f ~/.zshrc | xargs dirname`) }