Skip to content

Commit

Permalink
Add option to set template options
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Mar 18, 2020
1 parent a75a1f7 commit 4926a16
Show file tree
Hide file tree
Showing 4 changed files with 915 additions and 870 deletions.
9 changes: 9 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ type sourceVCSConfig struct {
Pull interface{}
}

type templateConfig struct {
Options []string
}

// A Config represents a configuration.
type Config struct {
configFile string
Expand All @@ -60,6 +64,7 @@ type Config struct {
GPG chezmoi.GPG
GPGRecipient string
SourceVCS sourceVCSConfig
Template templateConfig
Merge mergeConfig
Bitwarden bitwardenCmdConfig
CD cdCmdConfig
Expand Down Expand Up @@ -129,6 +134,9 @@ func newConfig(options ...configOption) *Config {
SourceVCS: sourceVCSConfig{
Command: "git",
},
Template: templateConfig{
Options: chezmoi.DefaultTemplateOptions,
},
Merge: mergeConfig{
Command: "vimdiff",
},
Expand Down Expand Up @@ -438,6 +446,7 @@ func (c *Config) getTargetState(populateOptions *chezmoi.PopulateOptions) (*chez
chezmoi.WithSourceDir(c.SourceDir),
chezmoi.WithTemplateData(data),
chezmoi.WithTemplateFuncs(c.templateFuncs),
chezmoi.WithTemplateOptions(c.Template.Options),
chezmoi.WithUmask(os.FileMode(c.Umask)),
)
if err := ts.Populate(fs, populateOptions); err != nil {
Expand Down
Loading

0 comments on commit 4926a16

Please sign in to comment.