-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rc
executable file
·61 lines (47 loc) · 1.88 KB
/
.rc
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# .rc.local
[ -r "~/.rc.local" ] && [ -f "~/.rc.local" ] . "~/.rc.local"
platform=""
unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
platform='macos'
elif [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
fi
unset unamestr
rc_dirname="$(dirname "$0")"
#generic dotfiles
# .{env,functions,aliases} .env, .functions, .aliases
# {.*,} support optional .prefix .myaliases.aliases or just .aliases (comma is important)
# {.*,}.$platform{.*,} allow prefix to occur after or/and before $platform (.myaliases.macos.new.aliases)
for file in $rc_dirname/{,vendor/*/*/}{.*,}.{env,functions,aliases}; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
for file in $rc_dirname/{,vendor/*/*/}{.*,}.{env,functions,aliases}; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
#platform specific dotfiles
for file in $rc_dirname/{,vendor/*/*/}.$platform{.*,}.{env,functions,aliases}; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
#application dotfiles
for file in $rc_dirname/{,vendor/*/*/}*/{.*,}.{env,functions,aliases}; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
#platform specific application dotfiles
for file in $rc_dirname/{,vendor/*/*/}*/.$platform{.*,}.{env,functions,aliases}; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
unset rc_dirname;
#local overides
for file in ~/{.*,}.{env,functions,aliases}.local; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
# platform local overrides
for file in ~/{.*,}.$platform{.*,}.{env,functions,aliases}.local; do
[ -r "$file" ] && [ -f "$file" ] && . "$file"
done;
unset file platform
# All files within a .name.d directory should be sourced from its parent "../.name"
# shell specific files (.zsh, .bash, etc) are sourced from within the applications .dotfiles directory
# any other .dotfile should be symlinked via the bootstrap.sh script or via an external source (tarranjones/setup)