blob: 91c2e69a2a12744075b4bcdff6393c3374431169 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# -*- mode: shell-script -*-
dotfiles_root() {
echo ${${(%):-%x}:A:h:h}
}
source_if_exists() {
local prefix file
for prefix in ${UNAME} ${DOMAIN} ${HOST_SHORT} ${HOST}; do
file=$(dotfiles_root)/dotfiles-${prefix}/$1
[[ -f ${file} ]] && . ${file}
done
return 0
}
export HOST=${HOST}
export HOST_SHORT=${${(%):-%m}:l}
export DOMAIN=${${${(%):-%M}#${HOST_SHORT}.}:l}
case ${OSTYPE} in
darwin*) export UNAME=darwin ;;
linux*) export UNAME=linux ;;
esac
setopt EXTENDED_GLOB
source_if_exists zsh/env
|