bake listing files not cached in config

This commit is contained in:
Bel LaPointe
2023-11-06 12:25:52 -07:00
parent 8dacd8da5d
commit d36f9e74b3
4 changed files with 56 additions and 20 deletions

View File

@@ -18,23 +18,18 @@ func add(config *config) error {
Schedule: pttodo.Schedule(config.addSchedule),
Tags: config.addTags,
}
newTarget, err := _add(config.targets, v)
if err != nil {
return err
}
config.targets = append(config.targets, newTarget)
return nil
return _add(config.Targets()[0], v)
}
func _add(filepaths []string, todo pttodo.Todo) (string, error) {
target := filepaths[0] + ".todo." + uuid.New().String()
func _add(filepath string, todo pttodo.Todo) error {
target := filepath + ".todo." + uuid.New().String()
c, err := yaml.Marshal([]pttodo.Todo{todo})
if err != nil {
return "", err
return err
} else if err := ioutil.WriteFile(target, c, os.ModePerm); err != nil {
return "", err
return err
}
return target, nil
return nil
}