-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (55 loc) · 4.41 KB
/
Copy pathMakefile
File metadata and controls
72 lines (55 loc) · 4.41 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
.PHONY: help setup doctor macos claude plugin dump brewdump codedump macdump dockdump menudump brewsnooze
.DEFAULT_GOAL := help
REPO := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
# Plugin-contributed sources merged into `make help` automatically: plugins mirror the repo layout under plugins/<name>/, with make targets in a *.mk fragment (not a full Makefile, to avoid clashing with this one) pulled in via -include, which also lists them in MAKEFILE_LIST for help. Plugin functions and aliases are grouped in their sections under a heading named after the plugin.
ALIAS_FILES := $(REPO)/zsh/.zsh_aliases $(wildcard $(REPO)/plugins/*/zsh/.zsh_aliases)
FUNC_FILES := $(wildcard $(REPO)/zsh/functions/*.sh) $(wildcard $(REPO)/plugins/*/zsh/functions/*.sh)
-include $(wildcard $(REPO)/plugins/*/*.mk)
BOLD := \033[1m
CYAN := \033[36m
DIM := \033[90m
RESET := \033[0m
COL_WIDTH := 13
##@ Setup
help: ## Print all available commands
@printf "\n$(BOLD)Make targets$(RESET) $(DIM)(run: make <target>)$(RESET)\n"
@awk 'BEGIN {FS = ":.*?## "} /^##@ / { printf "\n $(BOLD)%s$(RESET)\n", substr($$0,5); next } /^[a-zA-Z_-]+:.*?## / { printf " $(CYAN)%-$(COL_WIDTH)s$(RESET) $(DIM)│ %s$(RESET)\n", $$1, $$2 }' $(MAKEFILE_LIST)
@printf "\n$(BOLD)Identity$(RESET) $(DIM)(run in your shell)$(RESET)\n"
@printf " $(CYAN)%-$(COL_WIDTH)s$(RESET) $(DIM)│ %s$(RESET)\n" \
"mode" "Switch git/1Password identity: mode <work|home|switch|status>" \
"switch" "Shortcut for 'mode switch' - toggle between work and home"
@printf "\n$(BOLD)Functions$(RESET) $(DIM)(run in your shell)$(RESET)\n"
@awk 'FNR==1 { desc=""; g=""; if (FILENAME ~ /\/plugins\//) { g=FILENAME; sub(/.*\/plugins\//,"",g); sub(/\/.*/,"",g) } if (g != group) { group=g; if (g != "") printf "\n $(BOLD)%s$(RESET)\n", g } } /^# / { if (desc=="") desc=substr($$0,3); next } /^(function )?[a-zA-Z0-9_-]+\(\) *{/ { name=$$0; sub(/^function /,"",name); sub(/\(\).*/,"",name); if (name !~ /^(dockdump|menudump|mode)$$/) printf " $(CYAN)%-$(COL_WIDTH)s$(RESET) $(DIM)│ %s$(RESET)\n", name, desc; desc=""; next } { desc="" }' $(FUNC_FILES)
@printf "\n$(BOLD)Aliases$(RESET) $(DIM)(run in your shell)$(RESET)\n"
@awk 'FNR==1 { desc=""; g=""; if (FILENAME ~ /\/plugins\//) { g=FILENAME; sub(/.*\/plugins\//,"",g); sub(/\/.*/,"",g) } if (g != group) { group=g; if (g != "") printf "\n $(BOLD)%s$(RESET)\n", g } } /^## / { desc=""; printf "\n $(BOLD)%s$(RESET)\n", substr($$0,4); next } /^# / { if (desc=="") desc=substr($$0,3); next } /^alias / { name=$$0; sub(/^alias /,"",name); sub(/=.*/,"",name); if (name != "switch") printf " $(CYAN)%-$(COL_WIDTH)s$(RESET) $(DIM)│ %s$(RESET)\n", name, desc; desc=""; next } { desc="" }' $(ALIAS_FILES)
@printf "\n"
setup: ## Run the full dotfiles setup
@bash setup.sh
doctor: ## Check the health of the dotfiles setup
@bash setup/doctor.sh
macos: ## Reapply macOS config (preferences, defaults/menu-bar snapshots, hosts) without a full setup
@bash setup/macos.sh
@bash setup/hosts.sh
claude: ## Resync Claude Code config (agents, skills, hooks) into ~/.claude/ without a full setup
@bash setup/claude.sh
plugin: ## Register a private plugin repo and apply it. Usage: make plugin DIR=/path/to/plugin
@bash setup/plugin.sh "$(DIR)"
##@ Snapshots
dump: brewdump macdump dockdump menudump ## Snapshot full system state (brew, code, macos, dock, menu bar) back into the repo
brewdump: ## Regenerate Brewfile from installed packages (also syncs VS Code extensions)
@brew bundle dump --file=$(REPO)/Brewfile --force --no-vscode --describe
@date +%s > $$HOME/.brewdump_last
@$(MAKE) --no-print-directory codedump
codedump: ## Sync installed VS Code extensions into vscode/extensions.txt
@code --list-extensions > $(REPO)/vscode/extensions.txt
@echo "Synced $$(wc -l < $(REPO)/vscode/extensions.txt | tr -d ' ') VS Code extensions to vscode/extensions.txt"
macdump: ## Export macOS global defaults into macos/GlobalDefaults.plist
@defaults export NSGlobalDomain $(REPO)/macos/GlobalDefaults.plist
@echo "✅ macOS defaults exported"
dockdump: ## Snapshot the current Dock app order into macos/.osx
@bash -c 'source $(REPO)/zsh/functions/dockdump.sh && dockdump'
menudump: ## Snapshot the menu bar / Control Center layout into macos/
@bash -c 'source $(REPO)/zsh/functions/menudump.sh && menudump'
brewsnooze: ## Snooze the stale-Brewfile reminder for 30 days
@date +%s > $$HOME/.brewdump_last
@echo "Brewfile reminder snoozed for 30 days"