Files
dotfiles/home/dot_local/bin/executable_chezmoi-merge-helper.sh
Xevion 203666e720 feat: add chezmoi merge tools with VSCode integration and Fish helper
- Add VSCode-based merge helper with clear visual layout explanation
- Add Fish function for fzf-based interactive conflict selection
- Update CLAUDE.md with .tmpl file search patterns and tool usage guidelines
2026-01-13 16:26:34 -06:00

42 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# Helper script for chezmoi merge with clear labels
# Arguments: $1=destination $2=target $3=source
destination="$1"
target="$2"
source="$3"
# Create base file (copy of target state)
base="${target}.base"
cp "$target" "$base"
# Show clear explanation before merge
cat << EOF
╔════════════════════════════════════════════════════════════════╗
║ CHEZMOI MERGE LAYOUT ║
╠════════════════════════════════════════════════════════════════╣
║ ║
║ LEFT (Current): DESTINATION - File in your home dir ║
║ ↓ External changes (e.g., app updates) ║
║ ║
║ RIGHT (Incoming): TARGET - What chezmoi wants to apply ║
║ ↓ Your chezmoi changes (templates, etc) ║
║ ║
║ BOTTOM (Result): SOURCE - Will be saved to chezmoi repo ║
║ ║
╠════════════════════════════════════════════════════════════════╣
║ File: $(basename "$destination")
╚════════════════════════════════════════════════════════════════╝
Press Enter to open merge editor...
EOF
read -r
# Launch VSCode merge
# Syntax: code --merge <current> <incoming> <base> <result>
code --new-window --wait --merge "$destination" "$target" "$base" "$source"
# Cleanup
rm -f "$base"