-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathenv.rc
More file actions
44 lines (36 loc) · 925 Bytes
/
env.rc
File metadata and controls
44 lines (36 loc) · 925 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[[ "${__ENV_RC__:-""}" == yes ]] && return 0
__ENV_RC__=yes
function message() {
echo "${@}" >&2
}
function abort() {
message "${@}"
exit 1
}
function init() {
basedir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
rcdir="${basedir}/.dependencies/rc"
[[ -d "${rcdir}" ]] || abort "Please run 'bootstrap.sh', first!"
export PATH="${basedir}/.dependencies/homebrew/bin:${PATH}"
source "${rcdir}/sdk.rc"
source "${rcdir}/goenv.rc"
source "${rcdir}/caveats.rc"
}
function init_for_macos() {
init "${@}"
source "${rcdir}/.bash_profile"
}
function init_for_linux() {
init "${@}"
source "${rcdir}/.bashrc"
}
function main() {
if [[ "${OSTYPE}" == "darwin"* ]]; then
init_for_macos "${@}"
elif [[ "${OSTYPE}" == "linux-gnu" ]]; then
init_for_linux "${@}"
else
message "${OSTYPE}: no user terminal initialization step is defined for this os type. Going ahead."
fi
}
main "${@}"