-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·62 lines (52 loc) · 1.37 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
source $HOME/.dotfiles/scripts/os_variables.sh
source $HOME/.dotfiles/scripts/ansi_styles.sh
source $HOME/.dotfiles/scripts/hero.sh
source $HOME/.dotfiles/scripts/query_action.sh
source $HOME/.dotfiles/scripts/shell/setup_shell.sh
source $HOME/.dotfiles/scripts/package_manager/setup_package_manager.sh
capitalize_first_letter() {
echo "$(tr '[:lower:]' '[:upper:]' <<<"${1:0:1}")${1:1}"
}
restow() {
local OPTIND
local config="${1}"
printf "Stowing $config..."
stow --restow -t ~ -d $HOME/.dotfiles $config
printf "\r%s${Green}[✓]${Style_Off} Stowed $config\n"
}
restorw_all() {
echo "Restowing all config files:"
restow bin
restow zsh
restow alacritty
echo "....${Green}DONE${Style_Off}"
}
install_package() {
local package="${1}"
case $package in
brew) setup_package_manager "brew" ;;
fish) setup_shell "fish" ;;
all)
setup_package_manager "brew"
setup_shell "fish"
;;
*) return 1 ;; # illegal option
esac
}
main() {
local OPTIND
local arg
show_hero
[[ $# -eq 0 ]] && restorw_all
while getopts 'i:r:' arg; do
case ${arg} in
i) install_package ${OPTARG} ;;
r)
[ ${OPTARG} == "all" ] && restorw_all
[ ${OPTARG} == "all" ] || restow ${OPTARG}
;;
*) return 1 ;; # illegal option
esac
done
}
main $@