Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.chezmoi.config.destDir is not a string #3602

Closed
ErrrorMaxx opened this issue Feb 27, 2024 · 1 comment · Fixed by #3609
Closed

.chezmoi.config.destDir is not a string #3602

ErrrorMaxx opened this issue Feb 27, 2024 · 1 comment · Fixed by #3609
Labels
bug Something isn't working

Comments

@ErrrorMaxx
Copy link
Contributor

ErrrorMaxx commented Feb 27, 2024

Describe the bug

I think this is a odd, but I can't directly do string operations on .chezmoi.config.destDir. While it looks like a string, it is not allowed in string functions.

I currently use cat .chezmoi.config.destDir as a workaround

To reproduce

$ chezmoi execute-template '{{ .chezmoi.config.destDir | replace "abc" "def" }}'

Expected behavior

No error should happen

Output of command with the --verbose flag

$ chezmoi --verbose execute-template '{{ .chezmoi.config.destDir | replace "abc" "def" }}'
chezmoi: template: arg1:1:43: executing "arg1" at <"def">: wrong type for value; expected string; got chezmoi.AbsPath

Output of chezmoi doctor

$ 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]:58604->[::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-27T05:30:09Z
ok        source-dir                  ~/.local/share/chezmoi/home is a directory
ok        suspicious-entries          no suspicious entries
warning   working-tree                ~/.local/share/chezmoi is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
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
@twpayne
Copy link
Owner

twpayne commented Feb 29, 2024

Thanks for reporting this. The underlying problem is that replace is a template function from github.com/masterminds/sprig and pretty much all the functions in masterminds/sprig are inflexible and broken. See #2668 for work on a replacement.

#3609 adds a hacky work-around.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants