You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extract one Resolve-ToolPath helper for Windows binary lookup #96
Roughly 11 Windows PowerShell chezmoiscripts each carry their own copy of "find this tool's binary" logic — a Resolve-*Path function or an inline candidate-paths array plus a Get-Command fallback. That's ~350 lines of near-identical lookup logic. Each script is shallow at the lookup seam: the same fallback search is duplicated everywhere with only the tool name and candidate paths varying.
A smaller, related duplication: Assert-LastExitCode is defined identically in at least run_after_90_package_updates_windows.ps1.tmpl and run_onchange_after_bootstrap_windows.ps1.tmpl.
Files
Scripts with bespoke tool resolution (non-exhaustive):
Add home/.chezmoitemplates/windows-resolve-tool-path.ps1.tmpl: a parameterised helper that takes a tool name + candidate path list and returns a resolved path (Get-Command → candidate paths → fail), included the same way windows-elevation.ps1.tmpl is.
Replace each bespoke Resolve-* function / inline array with a call to the shared helper.
Move Assert-LastExitCode into windows-elevation.ps1.tmpl so callers inherit it instead of redefining it.
Confirm every touched .ps1.tmpl still renders to empty on non-Windows ({{ if eq .chezmoi.os "windows" }} guards intact).
Out of scope
Changing what any script does once it has the binary path.
Activity