Skip to content
Discussion options

You must be logged in to vote

Right. The mode you want won't work because this is a feature of go templating. However, you can do this (a) without missing-key=zero and (b) without this feature:

{{- $feature_a_key := (get . "feature_a_key") -}}
{{- if $feature_a_key -}}
# contents of enable-feature-a.conf, just use `$feature_a_key` instead of `.feature_a_key`
{{- end -}}

Unless you have the empty_ attribute set (foo.conf.d/empty_enable-feature-a.conf.tmpl), chezmoi will not create files that evaluate to empty contents, but they have to be completely empty (no whitespace or anything).

If there are multiple values to possibly check, you can easily do this with if or $a $b $c $d $e…; if all of them must be true, then if …

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@halostatue
Comment options

@cyqsimon
Comment options

@cyqsimon
Comment options

@halostatue
Comment options

Answer selected by cyqsimon
@cyqsimon
Comment options

@cyqsimon
Comment options

@twpayne
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