Skip to content

Commit

Permalink
feat: add method to save config
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanSpeakEasy committed Feb 18, 2023
1 parent f60cba5 commit 1340eb1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions io.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ func Load(dir string, lang string, opts ...Option) (*Config, error) {
return cfg, nil
}

func Save(dir string, cfg *Config, opts ...Option) error {
o := &options{
writeFileFunc: os.WriteFile,
}
for _, opt := range opts {
opt(o)
}

_, err := write(dir, cfg, o)
return err
}

func findConfigFile(dir string, o *options) ([]byte, error) {
path := filepath.Join(dir, "gen.yaml")

Expand Down

0 comments on commit 1340eb1

Please sign in to comment.