-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev
More file actions
executable file
·59 lines (49 loc) · 956 Bytes
/
dev
File metadata and controls
executable file
·59 lines (49 loc) · 956 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
script_dir="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
dry="0"
while [[ $# > 0 ]]; do
if [[ "$1" == "--dry" ]]; then
dry="1"
fi
shift
done
log() {
if [[ $dry == "1" ]]; then
echo "[DRY_RUN]: $@"
else
echo "$@"
fi
}
execute() {
log "execute: $@"
if [[ $dry == "1" ]]; then
return
fi
"$@"
}
log "--------- dev-env ---------"
log "script dir $script_dir"
cd $script_dir
copy_dir() {
pushd $1
to=$2
dirs=$(find . -maxdepth 1 -mindepth 1 -type d)
for dir in $dirs; do
execute rm -rf $to/$dir
execute cp -r $dir $to/$dir
done
popd
}
copy_file() {
from=$1
to=$2
name=$(basename $from)
execute rm $to/$name
execute cp $from $to/$name
}
copy_dir .config $XDG_CONFIG_HOME
copy_dir .local $HOME/.local
copy_file .profile $HOME
copy_file .zshrc $HOME
copy_file .bashrc $HOME
copy_file .ready-tmux $HOME