-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·117 lines (95 loc) · 2.98 KB
/
install
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
#!/usr/bin/env bash
set -euo pipefail
. "$(dirname "$0")/stow/bin/.lib"
# -----------------------------------------------------------------------------
# Global variables
# -----------------------------------------------------------------------------
CONFIGS=stow
# -----------------------------------------------------------------------------
# Helper functions start with _ and aren't listed in this script's help menu.
# -----------------------------------------------------------------------------
function _remove_default_dotfiles {
stow -Dt "$CONFIGS"
eok "unstowed previous stow"
einfo "Removing default ~/ configurations ..."
files=$(ls -a "$CONFIGS")
for location in "${files[@]}"; do
[[ "$location" != "." && "$location" != ".." && "$location" != ".config" ]] && rm -rf ~/"$location"
done
eok "done: Removing default ~/ configurations ..."
einfo "Removing default ~/.config configurations ..."
files=$(ls -a "$CONFIGS"/.config)
for location in "${files[@]}"; do
[[ "$location" != "." && "$location" != ".." ]] && rm -rf "$HOME/.config/$location"
done
eok "done: Removing default ~/.config configurations ..."
}
# -----------------------------------------------------------------------------
# Define your tasks below
# -----------------------------------------------------------------------------
function dotfiles { # Purge configs and reinstall dotfiles
ebox "!!! LAST CHANCE !!!"
echo "your spotlight_commands will be deleted"
echo "<ctrl>+c to cancel this operation"
echo "or type AGREE to continue"
read -r agree
if [ "$agree" == "AGREE" ]; then
_remove_default_dotfiles
restow
else
efail "Aborting..."
fi
}
function restow { # Update dotfiles
env
ebox "Installing dotfiles"
stow -Rt ~ "$CONFIGS"
eok "Installed dotfiles"
}
function apps { # Install brew casks and formulas
./osx/apps
./osx/start-apps
}
function defaults { # Set sensible macos defaults
./osx/defaults
}
function fonts { # Install fonts
ebox "Install fonts"
cp ./fonts/source-code-pro/*.ttf /Library/Fonts/
}
function neovim { # Install neovim tools
./osx/nvim
}
function stop-processes { # Stop or `install stop-processes --unload` processes
./osx/stop-processes "$@"
}
function env { # Setup the environment, create important directories
./osx/env
}
function update { # Update the important bits after git-pull
defaults
restow
apps
neovim
}
function fresh { # Do everything at once. Please run this only once ;)
ebox "Let's setup a fresh environment, shall we!"
# the order matters
defaults
apps
dotfiles
fonts
neovim
stop-processes --unload
}
# -----------------------------------------------------------------------------
function help { # Display this helpful help information
local functions
functions=$(grep -E "^function [^_]*?$" "$0" | sed -E "s/ *{ *# */#/g" | sed -E "s/^function / /g" | sort )
echo "Usage: $0 <task> [args]"
echo ""
echo "Tasks:"
echo "$functions" | column -t -s '#'
echo ""
}
"${@:-help}"