delete.go (506B)
1 package command 2 3 import ( 4 "fmt" 5 "time" 6 7 "code.dwrz.net/src/pkg/dqs/command/help" 8 "code.dwrz.net/src/pkg/dqs/entry" 9 "code.dwrz.net/src/pkg/dqs/store" 10 ) 11 12 var Delete = &command{ 13 execute: func(args []string, date time.Time, store *store.Store) error { 14 id := date.Format(entry.DateFormat) 15 16 if err := store.DeleteEntry(id); err != nil { 17 return fmt.Errorf("failed to delete entry: %w", err) 18 } 19 20 return nil 21 }, 22 23 description: "delete an entry", 24 help: help.Delete, 25 name: "delete", 26 }