From 8cf277ababd28c04ec5e4b868449ea10510a0797 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 26 Jan 2026 18:36:20 -0600 Subject: feat(makefile): add import target, rename adopt to reset New targets: - import: Use fzf to select ~/.config and ~/.local dirs to import into dotfiles/common/, then restow to create symlinks - reset: Renamed from adopt - clearer name for "resolve conflicts, keep repo version" Import workflow: 1. fzf multi-select from ~/.config and ~/.local 2. Move selected dirs to dotfiles/common/ 3. Restow common to create symlinks 4. Reminder to git commit Co-Authored-By: Claude Opus 4.5 --- Makefile | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index da4e3c2..c3e6cc7 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DOTFILES := $(shell pwd)/dotfiles # Extract DE from command line (e.g., 'make stow dwm' -> DE=dwm) DE := $(filter dwm hyprland,$(MAKECMDGOALS)) -.PHONY: help stow restow adopt unstow dwm hyprland +.PHONY: help stow restow reset unstow import dwm hyprland # Default target - show help help: @@ -22,14 +22,16 @@ help: @echo "Targets:" @echo " stow Create symlinks (fresh install)" @echo " restow Refresh symlinks (unlink + relink)" - @echo " adopt Pull system files into repo, then reset to repo version" + @echo " reset Resolve conflicts, keep repo version (adopt + git checkout)" @echo " unstow Remove all symlinks" + @echo " import Import new app configs into repo (fzf selector)" @echo "" @echo "Examples:" @echo " make stow dwm # Fresh DWM install" @echo " make stow hyprland # Fresh Hyprland install" @echo " make restow dwm # Refresh DWM links after git pull" - @echo " make adopt hyprland # Resolve conflicts, keep repo version" + @echo " make reset hyprland # Resolve conflicts, keep repo version" + @echo " make import # Select configs to import (no DE needed)" @echo "" # Prevent 'dwm' and 'hyprland' from being treated as file targets @@ -59,12 +61,12 @@ restow: check-de @cd $(DOTFILES) && $(STOW) --restow $(DE) @echo "Done." -# Adopt - pull system files into repo, then reset to repo version -adopt: check-de - @echo "Adopting common + $(DE)..." +# Reset - resolve conflicts by adopting then reverting to repo version +reset: check-de + @echo "Resetting common + $(DE)..." @cd $(DOTFILES) && $(STOW) --adopt common @cd $(DOTFILES) && $(STOW) --adopt $(DE) - @echo "Resetting adopted files to repo version..." + @echo "Reverting adopted files to repo version..." @git checkout -- dotfiles/ @echo "Done. Symlinks created, repo unchanged." @@ -74,3 +76,33 @@ unstow: check-de @cd $(DOTFILES) && $(STOW) --delete common @cd $(DOTFILES) && $(STOW) --delete $(DE) @echo "Done." + +# Import - select and import new app configs into repo +import: + @echo "Select directories to import (Tab to multi-select, Enter to confirm):" + @echo "" + @selections=$$({ \ + find $(HOME)/.config -maxdepth 1 -mindepth 1 -type d 2>/dev/null | sed 's|$(HOME)/||'; \ + find $(HOME)/.local -maxdepth 2 -mindepth 1 -type d 2>/dev/null | sed 's|$(HOME)/||'; \ + } | sort -u | fzf --multi --prompt="Import> " --header="Select configs to import into dotfiles/common/"); \ + if [ -z "$$selections" ]; then \ + echo "No selections made."; \ + exit 0; \ + fi; \ + echo ""; \ + for dir in $$selections; do \ + src="$(HOME)/$$dir"; \ + dest="$(DOTFILES)/common/$$dir"; \ + if [ -d "$$dest" ]; then \ + echo "Skipping $$dir (already exists in dotfiles)"; \ + else \ + echo "Importing $$dir..."; \ + mkdir -p "$$(dirname $$dest)"; \ + mv "$$src" "$$dest"; \ + fi; \ + done; \ + echo ""; \ + echo "Restowing common..."; \ + cd $(DOTFILES) && $(STOW) --restow common; \ + echo ""; \ + echo "Done. Don't forget to: git add -A && git commit" -- cgit v1.2.3