twpayne / chezmoi

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

function "stdinIsATTY" not defined"? #3057

Closed flowchartsman closed 1 year ago

flowchartsman commented 1 year ago

Describe the bug

❯ git clone https://github.com/twpayne/dotfiles
Cloning into 'dotfiles'...
remote: Enumerating objects: 8571, done.
remote: Counting objects: 100% (2296/2296), done.
remote: Compressing objects: 100% (1200/1200), done.
remote: Total 8571 (delta 1081), reused 2234 (delta 1022), pack-reused 6275
Receiving objects: 100% (8571/8571), 10.49 MiB | 6.26 MiB/s, done.
Resolving deltas: 100% (3092/3092), done.

❯ cd dotfiles/home

❯ chezmoi --verbose execute-template --stdinisatty <.chezmoi.toml.tmpl
chezmoi: template: stdin:46: function "stdinIsATTY" not defined

❯ cat .chezmoi.toml.tmpl | chezmoi --verbose execute-template --stdinisatty
chezmoi: template: stdin:46: function "stdinIsATTY" not defined

❯ chezmoi --interactive --verbose execute-template --stdinisatty <.chezmoi.toml.tmpl
chezmoi: template: stdin:46: function "stdinIsATTY" not defined

❯ chezmoi --version
chezmoi version v2.34.2, commit 473189051ec4950baa342f19ae7a824f0c1ded1f, built at 2023-06-17T00:27:17Z, built by Homebrew

To reproduce

As above

Expected behavior

Function exists?

Output of command with the --verbose flag

<< no change >>

Output of chezmoi doctor

❯ chezmoi doctor
RESULT   CHECK                MESSAGE
ok       version              v2.34.2, commit 473189051ec4950baa342f19ae7a824f0c1ded1f, built at 2023-06-17T00:27:17Z, built by Homebrew
ok       latest-version       v2.34.2
ok       os-arch              darwin/arm64
ok       uname                Darwin <myhost> 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
ok       go-version           go1.20.5 (gc)
ok       executable           /opt/homebrew/bin/chezmoi
ok       upgrade-method       brew-upgrade
ok       config-file          ~/.config/chezmoi/chezmoi.yaml, last modified 2023-06-20T10:37:31-04:00
ok       source-dir           ~/.local/share/chezmoi is a git working tree (clean)
ok       suspicious-entries   no suspicious entries
ok       working-tree         ~/.local/share/chezmoi is a git working tree (clean)
ok       dest-dir             ~ is a directory
ok       umask                022
ok       cd-command           found /opt/homebrew/bin/fish
ok       cd-args              /opt/homebrew/bin/fish
info     diff-command         not set
ok       edit-command         found /usr/bin/vim
ok       edit-args            /usr/bin/vim
ok       git-command          found /opt/homebrew/bin/git, version 2.38.1
ok       merge-command        found /usr/bin/vimdiff
ok       shell-command        found /opt/homebrew/bin/fish
ok       shell-args           /opt/homebrew/bin/fish
info     age-command          age not found in $PATH
ok       gpg-command          found /opt/homebrew/bin/gpg, version 2.4.0
info     pinentry-command     not set
info     1password-command    op not found in $PATH
ok       bitwarden-command    found /opt/homebrew/bin/bw, version 2023.5.0
info     dashlane-command     dcli 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     secret-command       not set

Additional context

Add any other context about the problem here.

flowchartsman commented 1 year ago

Aha, after pawing my way through the code a bit, it looks like looks like -i / --init is also required. Presumably since you'll only care about interaction during init. I got the impression from --help that --stdinisatty would solve this, but I guess I missed a doc somewhere? Perhaps this merits a doc clarification, but otherwise feel free to close.

flowchartsman commented 1 year ago

Gonna close this now as it looks like I was exercising a weird condition with my config in the wrong place.