use pointers for optional update fields to distinguish empty from unset

This commit is contained in:
2026-03-27 02:41:27 +01:00
parent 81fb9af5e2
commit 74cc7c104a
3 changed files with 19 additions and 11 deletions

View File

@@ -45,7 +45,8 @@ var editCmd = &cobra.Command{
}
if content, err := os.ReadFile(tmp.Name()); err == nil {
if err := d.UpdateNode(args[0], db.UpdateParams{Content: string(content)}); err != nil {
c := string(content)
if err := d.UpdateNode(args[0], db.UpdateParams{Content: &c}); err != nil {
fmt.Fprintln(os.Stderr, "failed to update:", err)
return
}