From 6c60e7d127bf621e03153a66db3140861e8137c8 Mon Sep 17 00:00:00 2001
From: Tony Blyler <tony@citizenmint.com>
Date: Tue, 3 Oct 2023 22:20:38 -0400
Subject: [PATCH] fix asdf upgrade_system section

---
 chezmoi/dot_zshrc.d/executable_upgrade_system.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/chezmoi/dot_zshrc.d/executable_upgrade_system.sh b/chezmoi/dot_zshrc.d/executable_upgrade_system.sh
index 6d948f2..c63c7c3 100644
--- a/chezmoi/dot_zshrc.d/executable_upgrade_system.sh
+++ b/chezmoi/dot_zshrc.d/executable_upgrade_system.sh
@@ -40,6 +40,17 @@ upgrade_system() {
 		if command -v asdf &> /dev/null; then
 			asdf update || true
 			asdf plugin update --all
+			asdf plugin list | awk -v TOOL_VERSIONS_FILE="${HOME}/.tool-versions" '{
+				plugins[$0] = 1
+			} END {
+				while ((getline < TOOL_VERSIONS_FILE) > 0) {
+					if (!plugins[$0]) {
+						print $0
+					}
+				}
+			}' | xargs -n 1 asdf plugin add
+			asdf install
+
 			echo -e 'package\tversion\tlatest\tstatus'
 			awk '{
 				package = $1