-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·642 lines (556 loc) · 19 KB
/
bootstrap
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
#!/usr/bin/env bash
##
# ./bootstrap
# - Installs and configures up a local development environment on macOS.
##
set -e
# ensure we include Homebrew and its installed binaries in $PATH, if installed
HOMEBREW_PATH=/usr/local/bin
CURRENT_PATH=$PATH
if [[ :$CURRENT_PATH: != *:"$HOMEBREW_PATH":* ]]; then
PATH=$CURRENT_PATH:$HOMEBREW_PATH
fi
SCRIPT_DIR="$(
cd "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)"
CONFIG_DIR="$HOME/.config"
NEOVIM_CONFIG_DIR="$CONFIG_DIR/nvim"
STARSHIP_CONFIG_PATH="$CONFIG_DIR/starship.toml"
TMUX_CONFIG_DIR="$CONFIG_DIR/tmux"
WTF_CONFIG_PATH="$CONFIG_DIR/wtf/config.yml"
STYLE_RESET=$(printf '\e[0m')
STYLE_BOLD=$(printf '\e[1m')
STYLE_HEADER=$(printf '\e[1;97m')
STYLE_SUBHEADER=$(printf '\e[1;36m')
STYLE_PARAGRAPH=$(printf '\e[2m')
STYLE_PARAGRAPH_INDENT=" "
STYLE_CLEAR_PREVIOUS_LINE="$(printf '\e[1A\e[2K')"
ARG_CMD_RECEIVED=""
ARG_HELP="help"
ARG_HELP_SHORT="h"
ARG_NUKE_EXISTING_CONFIG_ZSH="nuke-existing-zsh"
ARG_NUKE_EXISTING_CONFIG_VIM="nuke-existing-vim"
ARG_NUKE_EXISTING_CONFIG_ALL="nuke-all-existing"
POST_SHELL_SETUP_MESSAGE="Now go ahead and add what you need from ${SCRIPT_DIR/#$HOME/~}/.zshrc to ~/.zshrc (see the \"User configuration\" part specifically)."
POST_MACOS_SETUP_MESSAGE="Note that some macOS changes might require a reboot."
function showError {
echo -e "${STYLE_RESET}${STYLE_BOLD}\nERROR: $1${STYLE_RESET}" 1>&2
exit 1
}
function showInfo {
echo -e "${STYLE_RESET}${STYLE_HEADER}./$(basename $0)${STYLE_RESET}"
echo "Installs and configures up a local development environment."
echo
echo "Usage:"
echo -e " ${STYLE_RESET}${STYLE_SUBHEADER}--${ARG_HELP}${STYLE_RESET}|${STYLE_BOLD}-${ARG_HELP_SHORT}${STYLE_RESET}\n Show this help section"
echo -e " ${STYLE_RESET}${STYLE_SUBHEADER}--${ARG_NUKE_EXISTING_CONFIG_ZSH}${STYLE_RESET}\n Remove existing Zsh configuration"
echo -e " ${STYLE_RESET}${STYLE_SUBHEADER}--${ARG_NUKE_EXISTING_CONFIG_VIM}${STYLE_RESET}\n Remove existing Vim configuration"
echo -e " ${STYLE_RESET}${STYLE_SUBHEADER}--${ARG_NUKE_EXISTING_CONFIG_ALL}${STYLE_RESET}\n Remove all existing configurations"
}
function printHeader {
echo -e "${STYLE_RESET}\n${STYLE_HEADER}$1${STYLE_RESET}"
}
function printSubheader {
echo -e "${STYLE_RESET}\n${STYLE_HEADER}▸${STYLE_RESET} ${STYLE_SUBHEADER}$1${STYLE_RESET}"
}
function printParagraph {
echo -e "${STYLE_RESET}${STYLE_PARAGRAPH_INDENT}${STYLE_PARAGRAPH}$1${STYLE_RESET}"
}
function printFormattedParagraph {
printf "${STYLE_RESET}${STYLE_PARAGRAPH_INDENT}${STYLE_PARAGRAPH}$1${STYLE_RESET}"
}
function clearPreviousLine {
printf $STYLE_CLEAR_PREVIOUS_LINE
}
function confirm {
prompt="${1:-Are you sure?}"
clearLineAfterUserInput=${2:-false}
# call with a prompt string or use a default
read -r -p "$prompt (y/N) " response
case "$response" in
[yY][eE][sS] | [yY])
$clearLineAfterUserInput && clearPreviousLine
true
;;
*)
$clearLineAfterUserInput && clearPreviousLine
false
;;
esac
}
function waitForEnterKey {
read -p "Press Enter to continue"
clearPreviousLine
}
function showLoadingIndicatorUntilProcessHasEnded {
idOfProcessToWaitFor="$1"
spinCharacters='—\|/'
stty -echo # disable keyboard input
i=0
while kill -0 $idOfProcessToWaitFor 2>/dev/null; do
i=$(((i + 1) % 4))
printf "${STYLE_BOLD}${spinCharacters:$i:1}"
sleep 0.1
printf "\b"
done
stty echo # re-enable keybard input
printf "\b"
}
function nukeExistingZshConfig {
printParagraph "~/.oh-my-zsh"
[[ -d ~/.oh-my-zsh ]] && rm -rf ~/.oh-my-zsh
printParagraph "~/.zshrc"
[[ -f ~/.zshrc ]] && rm ~/.zshrc*
if [[ -f ~/.shell.pre-oh-my-zsh ]]; then
printParagraph "~/.shell.pre-oh-my-zsh"
rm ~/.shell.pre-oh-my-zsh
fi
}
function nukeExistingVimConfig {
printParagraph ${NEOVIM_CONFIG_DIR/#$HOME/'~'}
[[ -d $NEOVIM_CONFIG_DIR ]] && rm -rf $NEOVIM_CONFIG_DIR
local neovim_cache_dir="$HOME/.local/cache/nvim"
local neovim_data_dir="$HOME/.local/share/nvim"
local neovim_state_dir="$HOME/.local/state/nvim"
printParagraph ${neovim_cache_dir/#$HOME/'~'}
[[ -d $neovim_cache_dir ]] && rm -rf $neovim_cache_dir
printParagraph ${neovim_data_dir/#$HOME/'~'}
[[ -d $neovim_data_dir ]] && rm -rf $neovim_data_dir
printParagraph ${neovim_state_dir/#$HOME/'~'}
[[ -d $neovim_state_dir ]] && rm -rf $neovim_state_dir
}
function nukeExistingConfig {
case $ARG_CMD_RECEIVED in
$ARG_NUKE_EXISTING_CONFIG_ZSH)
echo -e "${STYLE_RESET}${STYLE_BOLD}WARNING: About to remove existing Zsh config.${STYLE_RESET}"
waitForEnterKey
clearPreviousLine
printHeader "Removing existing Zsh config..."
nukeExistingZshConfig
;;
$ARG_NUKE_EXISTING_CONFIG_VIM)
echo -e "${STYLE_RESET}${STYLE_BOLD}WARNING: About to remove existing Vim config.${STYLE_RESET}"
waitForEnterKey
clearPreviousLine
printHeader "Removing existing Vim config..."
nukeExistingVimConfig
;;
$ARG_NUKE_EXISTING_CONFIG_ALL)
echo -e "${STYLE_RESET}${STYLE_BOLD}WARNING: About to remove ALL existing configs.${STYLE_RESET}"
waitForEnterKey
clearPreviousLine
printHeader "Removing all existing configs..."
printSubheader "Remove existing Zsh config"
nukeExistingZshConfig
printSubheader "Remove existing Vim config"
nukeExistingVimConfig
;;
*)
showError "Invalid nuke config type $ARG_CMD_RECEIVED"
;;
esac
printHeader "🗑 All done!"
}
function verifyInstalledGuiApps {
printSubheader "GUI applications"
echo -e " ${STYLE_RESET}You might want to install some of the following applications:\n
• ${STYLE_RESET}${STYLE_BOLD}1Password${STYLE_RESET} - https://apps.apple.com/se/app/1password-7-password-manager/id1333542190?l=en&mt=12
• ${STYLE_RESET}${STYLE_BOLD}Alfred${STYLE_RESET} - https://www.alfredapp.com/
• ${STYLE_RESET}${STYLE_BOLD}Amphetamine${STYLE_RESET} - https://apps.apple.com/se/app/amphetamine/id937984704?l=en&mt=12"
echo
waitForEnterKey
clearPreviousLine
}
function setupMacOS {
printSubheader "macOS defaults"
if ! confirm "${STYLE_PARAGRAPH_INDENT}About to configure macOS defaults. Continue?" true; then
printParagraph "Leaving as-is"
sleep 1
return
fi
# if don't have cached sudo credentials, request new
if ! sudo -n true 2>/dev/null; then
printf "$STYLE_PARAGRAPH_INDENT"
sudo -v
clearPreviousLine
fi
printFormattedParagraph "Configuring... "
source $SCRIPT_DIR/.macos &
showLoadingIndicatorUntilProcessHasEnded $!
printFormattedParagraph "\bdone!\r\f"
printParagraph "$POST_MACOS_SETUP_MESSAGE"
sleep 1
}
function bootstrap {
printHeader "☕️ Bootstrapping work environment..."
echo "About to bootstrap development environment."
waitForEnterKey
clearPreviousLine
[[ ! -d $CONFIG_DIR ]] && mkdir -p $CONFIG_DIR
printSubheader "macOS Command Line Tools"
logFile="/tmp/cmdline-tools-install.$(date +%s)"
xcode-select --install &>$logFile || true
if [[ "$(cat $logFile)" == *"already installed"* ]]; then
printParagraph "Command Line Tools appears to be already installed"
fi
rm $logFile
verifyInstalledGuiApps
setupMacOS
printSubheader "Homebrew"
if [[ ! "$(command -v brew)" ]]; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
else
printParagraph "\`brew\` appears to be already installed, at $(which brew)"
fi
printSubheader "WezTerm"
if [[ ! "$(command -v wezterm)" ]]; then
brew install wezterm
else
printParagraph "\`wezterm\` appears to be already installed, at $(which wezterm)"
fi
printParagraph "Adding WezTerm config"
cp $SCRIPT_DIR/.wezterm.lua ~/.wezterm.lua
# https://wezfurlong.org/wezterm/faq.html?h=undercurl#how-do-i-enable-undercurl-curly-underlines
printParagraph "Adding WezTerm terminfo (fixing e.g. undercurl support for Neovim)"
tempfile=$(mktemp)
curl -fsSLo $tempfile https://raw.githubusercontent.com/wez/wezterm/master/termwiz/data/wezterm.terminfo
tic -x -o ~/.terminfo $tempfile
rm $tempfile
printSubheader "zsh"
if [[ ! "$(command -v zsh)" ]]; then
brew install zsh
else
printParagraph "\`zsh\` appears to be already installed, at $(which zsh)"
fi
printSubheader "Oh My Zsh"
export RUNZSH="no" # don't switch to zsh directly after installation
if [[ ! -d ~/.oh-my-zsh ]]; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
elif [[ "$SHELL" != "$(which zsh)" ]]; then
printParagraph "Oh My Zsh appears to be already installed but \$SHELL ($SHELL) is not set to $(which zsh) for current user. Changing it!"
chsh -s $(which zsh) $(whoami)
else
printParagraph "Oh My Zsh appears to be already installed"
fi
if [[ ! $(brew ls zsh-autosuggestions 2>/dev/null) ]]; then
printParagraph "Installing \`zsh-autosuggestions\`"
brew install zsh-autosuggestions
else
printParagraph "\`zsh-autosuggestions\` appears to be already installed"
fi
if [[ ! -f ~/.zshrc ]]; then
printParagraph "No ~/.zshrc found!"
printParagraph "- using the whole of $SCRIPT_DIR/.zshrc as ~/.zshrc"
cp $SCRIPT_DIR/.zshrc ~/.zshrc
fi
echo
printParagraph "Oh My Zsh installation completed!"
printParagraph "$POST_SHELL_SETUP_MESSAGE"
unset RUNZSH
printSubheader "Fonts for custom characters"
if [[ ! "$(brew ls font-hack-nerd-font)" ]]; then
brew install font-hack-nerd-font
else
printParagraph "\`font-hack-nerd-font\` appears to be already installed"
fi
printSubheader "Starship prompt"
if [[ ! "$(command -v starship)" ]]; then
brew install starship
else
printParagraph "\`starship\` appears to be already installed, at $(which starship)"
fi
if [[ ! -f $STARSHIP_CONFIG_PATH ]]; then
printParagraph "Adding config at $STARSHIP_CONFIG_PATH"
cp starship.toml $STARSHIP_CONFIG_PATH
else
printParagraph "Config already present at $STARSHIP_CONFIG_PATH"
fi
printSubheader "htop"
if [[ ! "$(command -v htop)" ]]; then
brew install htop
else
printParagraph "\`htop\` appears to be already installed, at $(which htop)"
fi
printSubheader "fzf"
if [[ ! "$(command -v fzf)" ]]; then
brew install fzf
else
printParagraph "\`fzf\` appears to be installed, at $(which fzf)"
fi
printSubheader "ripgrep"
if [[ ! "$(command -v rg)" ]]; then
brew install ripgrep
else
printParagraph "\`rg\` appears to be already installed, at $(which rg)"
fi
printParagraph "Adding ~/.rgignore"
cp $SCRIPT_DIR/.rgignore_global ~/.rgignore
printParagraph "Adding ~/.ripgreprc"
cp $SCRIPT_DIR/.ripgreprc ~/.ripgreprc
printSubheader "fd"
if [[ ! "$(command -v fd)" ]]; then
brew install fd
else
printParagraph "\`fd\` appears to be installed, at $(which fd)"
fi
printSubheader "ctags"
if [[ ! "$(brew ls --versions ctags)" ]]; then
# we want the one from Homebrew since .zshrc references that
brew install ctags
else
printParagraph "\`ctags\` appears to be already installed, at $(brew --prefix ctags)"
fi
printSubheader "asdf (https://asdf-vm.com/)"
if [[ ! "$(which asdf)" ]]; then
printParagraph "Installing latest version off of main branch"
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
source "$HOME/.asdf/asdf.sh"
else
printParagraph "\`asdf\` appears to be already installed, at $(which asdf)"
fi
if [[ ! $(asdf plugin list | grep nodejs) ]]; then
printParagraph "Installing asdf plugin \`nodejs\`"
asdf plugin add nodejs
fi
if [[ ! $(asdf plugin list | grep pnpm) ]]; then
printParagraph "Installing asdf plugin \`pnpm\`"
asdf plugin add pnpm
fi
if [[ ! $(asdf which node 2>/dev/null) ]]; then
printParagraph "Installing latest version of Node.js"
asdf install nodejs latest
asdf global nodejs latest
fi
if [[ ! $(asdf which pnpm 2>/dev/null) ]]; then
printParagraph "Installing latest version of pnpm"
asdf install pnpm latest
asdf global pnpm latest
fi
source "$HOME/.asdf/asdf.sh"
printSubheader "Deno"
if [[ ! "$(command -v deno)" ]]; then
brew install deno
else
printParagraph "\`deno\` appears to be already installed, at $(which deno)"
fi
printSubheader "pyenv"
if [[ ! "$(command -v pyenv)" ]]; then
brew install pyenv
else
printParagraph "\`pyenv\` appears to be already installed, at $(which pyenv)"
fi
printSubheader "Python 3"
if [[ ! "$(command -v python3)" ]]; then
latestPython3Version="$(pyenv install --list | awk '{print $1}' | grep '^[0-9]' | grep '\.[0-9]$' | grep '^3\.' | tail -1)"
printParagraph "Installing latest version of Python 3 ($latestPython3Version)"
pyenv install $latestPython3Version
else
printParagraph "\`python3\` appears to be already installed, at $(which python3)"
fi
printSubheader "pipenv"
if [[ ! "$(command -v pipenv)" ]]; then
brew install pipenv
else
printParagraph "\`pipenv\` appears to be already installed, at $(which pipenv)"
fi
printSubheader "Neovim"
[[ ! -d $NEOVIM_CONFIG_DIR ]] && mkdir -p $NEOVIM_CONFIG_DIR
if [[ ! "$(command -v nvim)" ]]; then
brew install neovim
else
printParagraph "\`nvim\` appears to be already installed, at $(which nvim)"
fi
printSubheader "Neovim Python3 provider"
if ! $(python3 -c "import neovim" 2>/dev/null); then
pip3 install neovim
else
printParagraph "\`neovim\` Python 3 package appears to be already installed"
fi
printSubheader "Neovim Node.js provider"
if ! $(node -e "require('neovim')" 2>/dev/null); then
npm i -g neovim
else
printParagraph "\`neovim\` Node.js package appears to be already installed"
fi
printSubheader "Neovim configs"
[[ ! -d $NEOVIM_CONFIG_DIR ]] && mkdir -p $NEOVIM_CONFIG_DIR
cp -r $SCRIPT_DIR/nvim $NEOVIM_CONFIG_DIR/../
printSubheader "VimR"
if [[ ! "$(command -v vimr)" ]]; then
brew install --cask vimr
else
printParagraph "\`vimr\` appears to be already installed, at $(which vimr)"
fi
printSubheader "tmux"
if [[ ! "$(command -v tmux)" ]]; then
brew install tmux
else
printParagraph "\`tmux\` appears to be already installed, at $(which tmux)"
fi
printParagraph "Adding config files"
[[ ! -d ${TMUX_CONFIG_DIR} ]] && mkdir -p "${TMUX_CONFIG_DIR}"
cp -r "${SCRIPT_DIR}/tmux" "${TMUX_CONFIG_DIR}/../"
if [[ ! -d ${TMUX_CONFIG_DIR}/plugins ]]; then
printParagraph "Installing tpm"
git clone https://github.com/tmux-plugins/tpm "${TMUX_CONFIG_DIR}/plugins/tpm"
else
printParagraph "tpm appears to be already installed"
fi
printSubheader "GitHub CLI"
if [[ ! "$(brew ls --versions gh)" ]]; then
brew install gh
else
printParagraph "\`gh\` appears to be already installed, at $(which gh)"
fi
printSubheader "GitX"
if [[ ! "$(command -v gitx)" ]]; then
brew install gitx
else
printParagraph "\`gitx\` appears to be already installed, at $(which gitx)"
fi
printSubheader "Global Git configuration"
if [[ ! -f ~/.gitignore ]]; then
printParagraph "Adding ~/.gitignore"
cp $SCRIPT_DIR/.gitignore_global ~/.gitignore
else
printParagraph "~/.gitignore already exists"
fi
if [[ ! -f ~/.gitattributes ]]; then
printParagraph "Adding ~/.gitattributes"
cp $SCRIPT_DIR/.gitattributes_global ~/.gitattributes
else
printParagraph "~/.gitattributes already exists"
fi
if [[ ! -f ~/.gitconfig ]]; then
printParagraph "Adding ~/.gitconfig"
cp $SCRIPT_DIR/.gitconfig_global ~/.gitconfig
else
printParagraph "~/.gitconfig already exists"
fi
if [[ "$(git config --global user.name)" == "" ]]; then
printf "\n Full name to use for Git: "
read globalGitUserName
git config --global user.name "$globalGitUserName"
fi
if [[ "$(git config --global user.email)" == "" ]]; then
printf "\n Email address to use for Git: "
read globalGitUserEmailAddress
git config --global user.email "$globalGitUserEmailAddress"
fi
printSubheader "tldr"
if [[ ! "$(command -v tldr)" ]]; then
npm i -g tldr
else
printParagraph "\`tldr\` appears to be already installed, at $(which tldr)"
fi
printSubheader "\`crawler\` Node.js package"
if ! $(node -e "require('crawler')" 2>/dev/null); then
npm i -g crawler
else
printParagraph "\`crawler\` Node.js package appears to be already installed"
fi
printSubheader "WTF Terminal Dashboard"
if [[ ! "$(command -v wtfutil)" ]]; then
brew install wtfutil
else
printParagraph "\`wtfutil\` appears to be already installed, at $(which wtfutil)"
fi
if [[ ! -f $WTF_CONFIG_PATH ]]; then
if [[ ! -d "$(dirname $WTF_CONFIG_PATH)" ]]; then
mkdir "$(dirname $WTF_CONFIG_PATH)"
fi
cp $SCRIPT_DIR/wtf_dashboard_config.yml $WTF_CONFIG_PATH
printParagraph "Added config at $WTF_CONFIG_PATH"
else
printParagraph "Config already exists at $WTF_CONFIG_PATH"
fi
printSubheader "tree"
if [[ ! "$(command -v tree)" ]]; then
brew install tree
else
printParagraph "\`tree\` appears to be already installed, at $(which tree)"
fi
printSubheader "macdown"
if [[ ! "$(command -v macdown)" ]]; then
brew install --cask macdown
else
printParagraph "\`macdown\` appears to be already installed"
fi
printSubheader "qlmarkdown"
if [[ ! $(brew ls --cask --versions qlmarkdown) ]]; then
brew install --cask qlmarkdown
else
printParagraph "\`qlmarkdown\` appears to be already installed."
fi
printSubheader "Rectangle"
if [[ ! $(brew ls rectangle 2>/dev/null) ]]; then
brew install rectangle
else
printParagraph "Rectangle appears to be already installed."
fi
printSubheader "BetterDisplay"
if [[ ! $(brew ls betterdisplay 2>/dev/null) ]]; then
brew install betterdisplay
else
printParagraph "BetterDisplay appears to be already installed."
fi
printSubheader "Gitify"
if [[ ! $(brew ls gitify 2>/dev/null) ]]; then
brew install gitify
else
printParagraph "Gitify appears to be already installed."
fi
if [[ :$CURRENT_PATH: != *:"$HOMEBREW_PATH":* ]]; then
# this will likely get modified by user from ~/.zshrc later
# but it's to ensure that some bare minimum paths are added
echo "
# Added by bootstrap script to ensure some directories are added to \$PATH.
# Most likely you will want to modify this when you add your own .zshrc config.
export PATH=\$PATH:$HOMEBREW_PATH" >>~/.zshrc
fi
printHeader "🎉 All done!"
echo $POST_SHELL_SETUP_MESSAGE
echo $POST_MACOS_SETUP_MESSAGE
echo
waitForEnterKey
clearPreviousLine
echo "${STYLE_PARAGRAPH}Activating environment..."
exec zsh -l
}
function main {
# parse arguments
while [ $# -gt 0 ]; do
case $1 in
"--$ARG_HELP")
showInfo
exit
;;
"-$ARG_HELP_SHORT")
showInfo
exit
;;
"--$ARG_NUKE_EXISTING_CONFIG_ZSH")
ARG_CMD_RECEIVED=$ARG_NUKE_EXISTING_CONFIG_ZSH
nukeExistingConfig
exit
;;
"--$ARG_NUKE_EXISTING_CONFIG_VIM")
ARG_CMD_RECEIVED=$ARG_NUKE_EXISTING_CONFIG_VIM
nukeExistingConfig
exit
;;
"--$ARG_NUKE_EXISTING_CONFIG_ALL")
ARG_CMD_RECEIVED=$ARG_NUKE_EXISTING_CONFIG_ALL
nukeExistingConfig
exit
;;
*)
showError "Invalid option $1"
;;
esac
shift
done
bootstrap
}
main "$@"