-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.sh
More file actions
executable file
·98 lines (89 loc) · 3.5 KB
/
Copy pathpreview.sh
File metadata and controls
executable file
·98 lines (89 loc) · 3.5 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
93
94
95
96
97
98
#!/usr/bin/env bash
# Preview what install.py --all would do on this machine.
# Read-only — touches nothing.
#
# Usage:
# ./preview.sh # core
# ./preview.sh --with-apps # core + personal apps
set -u
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WITH_APPS=0
[[ "${1:-}" == "--with-apps" ]] && WITH_APPS=1
cyan() { printf "\033[36m%s\033[0m\n" "$*"; }
green() { printf "\033[32m%s\033[0m\n" "$*"; }
yellow() { printf "\033[33m%s\033[0m\n" "$*"; }
red() { printf "\033[31m%s\033[0m\n" "$*"; }
dim() { printf "\033[2m%s\033[0m\n" "$*"; }
cyan "=== Symlink predictions ==="
PAIRS=(
"$HOME/.zshrc:config/zsh/zshrc"
"$HOME/.zshrc_benami:config/zsh/zshrc_benami"
"$HOME/.config/starship.toml:config/starship.toml"
"$HOME/.config/git/config:config/git/config"
"$HOME/.config/git/ignore:config/git/ignore"
"$HOME/.config/nvim:config/nvim"
"$HOME/.tmux.conf:config/tmux/tmux.conf"
)
for pair in "${PAIRS[@]}"; do
dest="${pair%%:*}"
src="${pair##*:}"
fullsrc="$DOTFILES_DIR/$src"
if [[ -L "$dest" ]]; then
target="$(readlink "$dest")"
if [[ "$target" == "$fullsrc" ]]; then
green " OK $dest"
else
yellow " RELINK $dest (was: $target)"
fi
elif [[ -e "$dest" ]]; then
yellow " BACKUP+LINK $dest (real file/dir would be moved to backup/)"
else
green " NEW $dest"
fi
done
echo ""
cyan "=== Tools / runtimes ==="
command -v cargo >/dev/null && green " rustup/cargo: installed" || yellow " rustup/cargo: WOULD INSTALL"
[[ -d "$HOME/.oh-my-zsh" ]] && green " oh-my-zsh: installed" || yellow " oh-my-zsh: WOULD INSTALL"
[[ -d "$HOME/.oh-my-zsh/custom/plugins/asksh" ]] && green " asksh: installed" || yellow " asksh: WOULD CLONE"
[[ -d "$HOME/.tmux/plugins/tpm" ]] && green " tpm (tmux plugins): installed" || yellow " tpm: WOULD CLONE"
echo ""
cyan "=== iTerm2 prefs ==="
CUR_LOAD="$(defaults read com.googlecode.iterm2 LoadPrefsFromCustomFolder 2>/dev/null || echo unset)"
CUR_FOLDER="$(defaults read com.googlecode.iterm2 PrefsCustomFolder 2>/dev/null || echo unset)"
DESIRED_FOLDER="$DOTFILES_DIR/config/iterm2"
if [[ "$CUR_LOAD" == "1" && "$CUR_FOLDER" == "$DESIRED_FOLDER" ]]; then
green " Already pointing at $DESIRED_FOLDER"
else
yellow " Would set LoadPrefsFromCustomFolder=1, PrefsCustomFolder=$DESIRED_FOLDER"
dim " (current: load=$CUR_LOAD folder=$CUR_FOLDER)"
fi
echo ""
cyan "=== macOS defaults ==="
yellow " Would run scripts/macos-defaults.sh:"
dim " - Finder/Dock/screenshot prefs"
dim " - hot corner (bottom-right = Quick Note)"
dim " - NSUserKeyEquivalents: Fill -> Cmd+Ctrl+Return"
dim " - Restore symbolichotkeys.plist (15 disabled hotkeys)"
dim " - killall Dock Finder SystemUIServer cfprefsd"
dim " Will prompt for sudo."
echo ""
cyan "=== Brewfile (core) ==="
if command -v brew >/dev/null; then
brew bundle check --file="$DOTFILES_DIR/Brewfile" --verbose 2>&1 \
| grep -E "^(→|The Brewfile|Cask|brew bundle)" \
| sed 's/^/ /' || true
else
red " brew not installed — bootstrap.sh would install it"
fi
echo ""
if (( WITH_APPS )); then
cyan "=== Brewfile.personal (--with-apps) ==="
if command -v brew >/dev/null; then
brew bundle check --file="$DOTFILES_DIR/Brewfile.personal" --verbose 2>&1 \
| grep -E "^(→|The Brewfile|Cask|brew bundle)" \
| sed 's/^/ /' || true
fi
echo ""
fi
dim "Done. Re-run with --with-apps to also preview personal apps."