twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
13.36k stars 493 forks source link

splitList and quoteList don't work in pair #3603

Closed ErrrorMaxx closed 8 months ago

ErrrorMaxx commented 8 months ago

Describe the bug

splitList and quoteList don't work in pair

To reproduce

$ chezmoi execute-template '{{ "a b" | splitList " " | quoteList }}'

Expected behavior

This template should not fail and return list of quoted strings

Output of command with the --verbose flag

$ chezmoi --verbose execute-template '{{ "a b" | splitList " " | quoteList }}'
chezmoi: template: arg1:1:27: executing "arg1" at <quoteList>: wrong type for value; expected []interface {}; got []string

Output of chezmoi doctor

```console $ chezmoi doctor RESULT CHECK MESSAGE ok version v2.47.0, commit 39bd915f446068862cc3064edb6dbeee795785ca, built at 2024-02-25T20:56:37Z, built by goreleaser failed latest-version Get "https://api.github.com/repos/twpayne/chezmoi/releases/latest": dial tcp: lookup api.github.com on [::1]:53: read udp [::1]:45512->[::1]:53: read: connection refused ok os-arch android/arm64 ok uname Linux localhost 4.19.191+ #1 SMP PREEMPT Wed Nov 29 21:44:22 CST 2023 aarch64 Android ok go-version go1.22.0 (gc) ok executable ~/.local/bin/chezmoi ok upgrade-method replace-executable ok config-file ~/.config/chezmoi/chezmoi.yaml, last modified 2024-02-27T08:39:04Z warning source-dir ~/.local/share/chezmoi is a git working tree (dirty) warning suspicious-entries ~/.local/share/chezmoi/home/dot_config/rootmoi/chezmoi.yaml.tmpl warning working-tree ~/.local/share/chezmoi is a git working tree (dirty) warning dest-dir ~ is a git working tree (dirty) warning umask 077 ok cd-command found /data/data/com.termux/files/usr/bin/zsh ok cd-args /data/data/com.termux/files/usr/bin/zsh info diff-command not set ok edit-command found /data/data/com.termux/files/usr/bin/micro ok edit-args micro ok git-command found /data/data/com.termux/files/usr/bin/git, version 2.44.0 warning merge-command vimdiff not found in $PATH ok shell-command found /data/data/com.termux/files/usr/bin/zsh ok shell-args /data/data/com.termux/files/usr/bin/zsh info age-command age not found in $PATH ok gpg-command found /data/data/com.termux/files/usr/bin/gpg, version 2.4.4 info pinentry-command not set info 1password-command op not found in $PATH info bitwarden-command bw not found in $PATH info bitwarden-secrets-command bws not found in $PATH info dashlane-command dcli not found in $PATH info doppler-command doppler not found in $PATH info gopass-command gopass not found in $PATH info keepassxc-command keepassxc-cli not found in $PATH info keepassxc-db not set info keeper-command keeper not found in $PATH info lastpass-command lpass not found in $PATH info pass-command pass not found in $PATH info passhole-command ph not found in $PATH info rbw-command rbw not found in $PATH info vault-command vault not found in $PATH info vlt-command vlt not found in $PATH info secret-command not set ```
bradenhilton commented 8 months ago

splitList uses strings.Split (which returns []string) and quoteList expects its list parameter to be []any. You can't directly pass []string to a function expecting []any. I suspect this requires an override for splitList that converts the output to []interface{} or something.