[!windows] chmod 755 bin/secret
[windows] unix2dos bin/secret.cmd

# test secret template function
exec chezmoi execute-template '{{ secret "password" }}'
stdout ^password$

# test secretJSON template function
exec chezmoi execute-template '{{ (secretJSON "{\"password\":\"secret\"}").password }}'
stdout ^secret$

chhome home2/user

# test secret.args
exec chezmoi execute-template '{{ secret "password" }}'
stdout '^arg password$'

-- bin/secret --
#!/bin/sh

echo "$*"
-- bin/secret.cmd --
@echo off
setlocal
set out=%*
set out=%out:\=%
echo %out%
endlocal
-- home/user/.config/chezmoi/chezmoi.toml --
[secret]
    command = "secret"
-- home2/user/.config/chezmoi/chezmoi.yaml --
secret:
  args:
  - "arg"
  command: "secret"
