Closed cosandr closed 4 years ago
Perhaps this is intentional, the bitwarden function is not available when chezmoi init tries to generate a config file from a template.
chezmoi init
$ chezmoi init -v --debug Reinitialized existing Git repository in /home/andrei/.local/share/chezmoi/.git/ 2020/02/10 17:31:58 Run("/usr/bin/git init") (1.59716ms) ( cd /home/andrei/.local/share/chezmoi && /usr/bin/git init ) chezmoi: template: chezmoi.toml:2: function "bitwarden" not defined
For chezmoi init to have the secret functions available like the other templates do.
Rename .chezmoi.toml.tmpl to something else, for example make_chezmoi_cfg and run chezmoi cat instead.
.chezmoi.toml.tmpl
make_chezmoi_cfg
chezmoi cat
mkdir -p ~/.config/chezmoi chezmoi cat ~/make_chezmoi_cfg > ~/.config/chezmoi/chezmoi.toml
$ cat make_chezmoi_cfg.tmpl [data] {{- range (bitwarden "item" "chezmoi").fields -}} {{- if eq .type 1.0 }} {{ .name }} = "{{ .value }}" {{- end }} {{- end -}} $ chezmoi cat ~/make_chezmoi_cfg [data] public_email = "<VALUE>" public_name = "<VALUE>" private_email = "<VALUE>" private_name = "<VALUE>" ssh_domain = "<VALUE>" ssh_port = "<VALUE>" $ chezmoi doctor ok: version 1.7.12, commit bed22fcb91787c0d3d2d8ca61ebfe7799380f961, built at 2020-01-24T02:30:18Z ok: runtime.GOOS linux, runtime.GOARCH amd64 ok: /home/andrei/.local/share/chezmoi (source directory, perm 700) ok: /home/andrei (destination directory, perm 700) ok: /home/andrei/.config/chezmoi/chezmoi.toml (configuration file) ok: /bin/zsh (shell) ok: /usr/bin/vim (editor) ok: /usr/bin/vimdiff (merge command) ok: /usr/bin/git (source VCS command, version 2.21.1) ok: /usr/bin/gpg (GnuPG, version 2.2.18) warning: op (1Password CLI, not found) ok: /home/andrei/.local/bin/bw (Bitwarden CLI, version 1.8.0) warning: gopass (gopass CLI, not found) warning: keepassxc-cli (KeePassXC CLI, not found) warning: lpass (LastPass CLI, not found) warning: pass (pass CLI, not found) warning: vault (Vault CLI, not found)
Thank you very much for the detailed feature request :)
Is your feature request related to a problem? Please describe.
Perhaps this is intentional, the bitwarden function is not available when
chezmoi init
tries to generate a config file from a template.Describe the solution you'd like
For
chezmoi init
to have the secret functions available like the other templates do.Describe alternatives you've considered
Rename
.chezmoi.toml.tmpl
to something else, for examplemake_chezmoi_cfg
and runchezmoi cat
instead.Additional context