# test reading args
chezmoi execute-template '{{ "arg-template" }}'
stdout arg-template

[short] stop

# test reading from stdin
stdin golden/stdin.tmpl
chezmoi execute-template
stdout stdin-template

# test partial templates work
chezmoi execute-template '{{ template "partial" }}'
stdout 'hello world'

# test --init --promptBool
chezmoi execute-template --init --promptBool value=yes '{{ promptBool "value" }}'
stdout true
! chezmoi execute-template --promptBool value=error
stderr 'invalid syntax'

# test --init --promptInt
chezmoi execute-template --init --promptInt value=1 '{{ promptInt "value" }}'
stdout 1
! chezmoi execute-template --promptInt value=error
stderr 'invalid syntax'

# test --init --promptString
chezmoi execute-template --init --promptString email=you@example.com '{{ promptString "email" }}'
stdout 'you@example.com'

-- golden/stdin.tmpl --
{{ "stdin-template" }}
-- home/user/.config/chezmoi/chezmoi.toml --
[data.last]
  config = "chezmoi.toml"
  global = "chezmoi.toml"
-- home/user/.local/share/chezmoi/.chezmoitemplates/partial --
{{ cat "hello" "world" }}
