-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy-from-home-dir.sh
executable file
·67 lines (59 loc) · 1.18 KB
/
copy-from-home-dir.sh
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
62
63
64
65
66
67
#!/bin/bash
set -e
CODE_SUCCESS=10
CODE_SKIP=20
get-exit-symbol () {
local exit_code=$1
local symbol="$2"
case $exit_code in
$CODE_SUCCESS )
echo -n "$Green $symbol $Color_Off" ;;
$CODE_SKIP )
echo -n "$Yellow $symbol $Color_Off" ;;
* )
echo -n "$Red $symbol $Color_Off" ;;
esac
}
clean-local-path () {
local path="$1"
if [ -e ./"$path" ] ; then
rm -r ./"$path"
echo $CODE_SUCCESS
else
echo $CODE_SKIP
fi
}
update-local-path () {
local path="$1"
if [ -e ~/"$path" ] ; then
cp -r ~/"$path" ./
echo $CODE_SUCCESS
else
echo $CODE_SKIP
fi
}
copy-from-home () {
local path="$1"
if [ -e ./"$path" ] ; then
get-exit-symbol $(clean-local-path "$path") clean
get-exit-symbol $(update-local-path "$path") update
else
get-exit-symbol $CODE_SKIP clean
get-exit-symbol $CODE_SKIP update
fi
echo " $path"
}
echo "pulling files from home dir..."
echo
copy-from-home .bash_aliases
copy-from-home .bash_colors
copy-from-home .bash_env
copy-from-home .bash_profile
copy-from-home .bash_ps1
copy-from-home .bashrc
copy-from-home .hyper.js
copy-from-home .ripgrep
copy-from-home .tmux.conf
echo
echo "...done!"
echo