-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·93 lines (78 loc) · 2.12 KB
/
Copy pathinstall
File metadata and controls
executable file
·93 lines (78 loc) · 2.12 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
DOTFILES=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
ALL_PARTS=("brew" "zsh" "nvim" "tmux" "scripts" "wezterm" "licenses", "ghostty")
# Parse arguments into an array
if [ "$#" -eq 0 ]; then
# No arguments provided; ask for confirmation
echo "You did not specify any parts. This will install ALL parts: ${ALL_PARTS[*]}"
echo "Do you want to proceed? (yes/no)"
read -r response
case "$response" in
yes|y|Y)
PARTS=("${ALL_PARTS[@]}")
;;
no|n|N)
echo "Abandoning installation."
exit 0
;;
*)
echo "Invalid response. Abandoning installation."
exit 1
;;
esac
else
# Use provided arguments as parts to install
PARTS=("$@")
fi
brew() {
rm -rf $HOME/Brewfile
ln -s $DOTFILES/Brewfile $HOME/Brewfile
brew bundle
}
zsh() {
rm -rf $HOME/.zshrc
ln -s $DOTFILES/zsh/zsh.conf $HOME/.zshrc
}
nvim() {
rm -rf $HOME/.config/nvim
mkdir -p $HOME/.config
ln -s $DOTFILES/nvim $HOME/.config
}
tmux() {
rm -rf $HOME/.tmux.conf
rm -rf $HOME/.config/tmux
mkdir -p $HOME/.config
ln -s $DOTFILES/tmux $HOME/.config
}
scripts() {
rm -rf $HOME/bin
mkdir -p $HOME/bin
ln -s $DOTFILES/scripts/* $HOME/bin
}
wezterm() {
rm -rf $HOME/.wezterm.lua
ln -s $DOTFILES/wezterm/config.lua $HOME/.wezterm.lua
}
ghostty() {
rm -rf $HOME/.config/ghostty
mkdir -p $HOME/.config/ghostty
ln -s $DOTFILES/ghostty/config $HOME/.config/ghostty/config
}
intelephense() {
rm -rf $HOME/intelephense/licence.txt
mkdir -p $HOME/intelephense/
ln -s $DOTFILES/intelephense_licence.txt $HOME/intelephense/licence.txt
}
for part in "${PARTS[@]}"; do
if printf '%s\n' "${ALL_PARTS[@]}" | grep -qx "$part"; then
if command -v "$part" >/dev/null 2>&1; then
echo "Executing $part..."
"$part" # Call the function dynamically
echo "$part completed successfully."
else
echo "Skipping $part: Function not implemented."
fi
else
echo "Unknown part: $part. Skipping."
fi
done