From eacde7f1676b5fac807b2dd0153756332d4ad735 Mon Sep 17 00:00:00 2001 From: Michael Kobit Date: Wed, 15 Jul 2026 10:32:14 -0500 Subject: [PATCH] fix(scripts): guard uninstall block against missing package_name `{{ index $tool "package_name" }}` renders `` when the key is absent, producing invalid shell syntax at the `2>/dev/null` redirect. Skip the uninstall entirely when no package_name is configured. Co-Authored-By: Claude Sonnet 4.6 Committed-By-Agent: claude --- .../run_onchange_after_08_install-local-bin-tools.sh.tmpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chezmoi/.chezmoiscripts/run_onchange_after_08_install-local-bin-tools.sh.tmpl b/src/chezmoi/.chezmoiscripts/run_onchange_after_08_install-local-bin-tools.sh.tmpl index 151a659a..bad1108d 100644 --- a/src/chezmoi/.chezmoiscripts/run_onchange_after_08_install-local-bin-tools.sh.tmpl +++ b/src/chezmoi/.chezmoiscripts/run_onchange_after_08_install-local-bin-tools.sh.tmpl @@ -20,7 +20,10 @@ fi UV_TOOL_BIN_DIR="{{ $.chezmoi.destDir }}/.local/bin/dotfiles" \ "$MISE" exec --cd "{{ $root }}" -- uv tool install --force --editable "{{ $root }}/{{ $tool.source_dir }}" {{- else if eq $method "uninstall" }} +{{- $pkg := index $tool "package_name" -}} +{{- if $pkg }} UV_TOOL_BIN_DIR="{{ $.chezmoi.destDir }}/.local/bin/dotfiles" \ - "$MISE" exec --cd "{{ $root }}" -- uv tool uninstall {{ index $tool "package_name" }} 2>/dev/null || true + "$MISE" exec --cd "{{ $root }}" -- uv tool uninstall {{ $pkg }} 2>/dev/null || true +{{- end }} {{- end }} {{ end -}}