Files
xavierandClaude Sonnet 5 dd229593aa feat(mise): Support tools with custom mise params (e.g. tea)
Replace the hardcoded 'tea' special case in mise-tools with a generic
mechanism: a tool entry in tools.yaml/hosts.yaml can now be either a
plain string ("latest") or a map keyed by tool name whose value holds
mise params (version, url, asset_pattern, ...). This generalizes to
any future tool needing more than "latest", instead of requiring a
new hardcoded branch per tool.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 22:23:26 +02:00

54 lines
2.1 KiB
Plaintext

{{/* .chezmoitemplates/mise-tools */}}
{{- $hostname := output "hostname" | trim -}}
{{- $username := .chezmoi.username }}
# Configuration personnalisée pour l'utilisateur {{ $username }} et l'hôte {{ $hostname }}
{{- $currentHost := index .hosts $hostname -}}
{{- $currentUser := "" -}}
{{- if $currentHost }}
{{- if hasKey $currentHost.users $username }}
{{- $currentUser = index $currentHost.users $username -}}
{{- end }}
{{- end }}
{{- if $currentUser }}
{{- /* 1. Parcourir les toolboxes associées à cet hôte */}}
{{- range $toolboxName := $currentUser.toolboxes }}
{{- /* Récupérer la liste des outils pour cette toolbox dans tools.yaml */}}
{{- $toolsList := index $.tools.toolboxes $toolboxName }}
{{- if $toolsList }}
# Toolbox: {{ $toolboxName }}
{{- range $tool := $toolsList }}
{{- /* Un outil est soit une chaîne ("nom"), soit un objet { nom: {version, ...params mise} } */}}
{{- if kindIs "map" $tool }}
{{- range $toolName, $params := $tool }}
{{ $toolName }} = { version = "{{ $params.version | default "latest" }}"{{ range $key, $value := omit $params "version" }}, {{ $key }} = "{{ $value }}"{{ end }} }
{{- end }}
{{- else }}
"{{ $tool }}" = "latest"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- /* 2. Parcourir les outils individuels (la liste 'tools:' de l'utilisateur) */}}
{{- if hasKey $currentUser "tools" }}
{{- if $currentUser.tools }}
# Outils individuels
{{- range $tool := $currentUser.tools }}
{{- if kindIs "map" $tool }}
{{- range $toolName, $params := $tool }}
{{ $toolName }} = { version = "{{ $params.version | default "latest" }}"{{ range $key, $value := omit $params "version" }}, {{ $key }} = "{{ $value }}"{{ end }} }
{{- end }}
{{- else }}
"{{ $tool }}" = "latest"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- else if $currentHost }}
# Aucun profil trouvé dans hosts.yaml pour l'utilisateur {{ $username }} sur la machine : {{ $hostname }}
{{- else }}
# Aucun profil trouvé dans hosts.yaml pour la machine : {{ $hostname }}
{{- end }}