Skip to content

init --prompt* asks for the whole prompt, is this intended functionality? #3225

Answered by twpayne
frantathefranta asked this question in Q&A
Discussion options

You must be logged in to vote

So I am using it correctly?

No. The --promptBool flags are for testing your config file template with chezmoi execute-template so you don't have to re-enter the answers each time.

If you want to set up a machine automatically, either use template logic in your config file template, or use an environment variable.

For example:

{{ $email := "" }}
{{ if eq .chezmoi.hostname "work-machine" }}
{{   $email = "[email protected]" }}
{{ else if eq .chezmoi.hostname "home-machine" }}
{{   $email = "[email protected]" }}
{{ else }}
{{   $email = promptStringOnce . "email" "Email address" }}
{{ end }}

or

{{ $email := env "EMAIL" }}
{{ if not $email }}
{{   $email = promptStringOnce . "email" "Email addres…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@frantathefranta
Comment options

@twpayne
Comment options

Answer selected by frantathefranta
@frantathefranta
Comment options

Comment options

You must be logged in to vote
1 reply
@frantathefranta
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants