-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
38 lines (31 loc) · 856 Bytes
/
install.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
#!/bin/zsh
MODULE_FILES=(
"init.lua"
"restore_spaces"
)
DESTINATIONS=(
"$HOME/.hammerspoon"
"$HOME/.hammerspoon/hs"
)
function install_restore_spaces() {
local ALL_FILES=("${(@P)1}")
local ALL_DESTINATIONS=("${(@P)2}")
#echo "$ALL_FILES"
#echo "$ALL_DESTINATIONS"
echo "Installing 'restore_spaces' module..."
for (( i=1; i<=${#ALL_FILES[@]}; i++ )); do
DESTINATION=${ALL_DESTINATIONS[$i]}
FILE=${ALL_FILES[$i]}
echo "Copying $FILE to $DESTINATION"
if [[ ! -d $DESTINATION ]]; then
mkdir -p $DESTINATION
fi
if [[ -e $FILE ]]; then
cp -r "$FILE" "$DESTINATION"
else
echo "File not found: $FILE"
fi
done
echo "Installed 'restore_spaces' module."
}
install_restore_spaces MODULE_FILES DESTINATIONS