ohmyzsh/plugins/profiles/profiles.plugin.zsh
Abhishek Mukherjee 08beed0853 Add support in profiles plugin for directories
The profiles plugin currently has support to load a single "profile"
file for each component in the FQDN. This changeset makes it so the
plugin supports the filename actually being a directory with multiple
*.zsh files in it. Each of those files are then loaded in alphabetical
order
2015-10-14 17:51:58 -07:00

16 lines
507 B
Bash

# You will probably want to list this plugin as the first in your .zshrc.
# This will look for a custom profile for the local machine and each domain or
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
parts=(${(s:.:)HOST})
for i in {${#parts}..1}; do
profile=${(j:.:)${parts[$i,${#parts}]}}
file=$ZSH_CUSTOM/profiles/$profile
if [ -d $file ]; then
for config_file ($file/*.zsh(N)); do
source $config_file
done
elif [ -f $file ]; then
source $file
fi
done