Some convenience methods for Metas

This commit is contained in:
Dan Jones 2024-03-11 16:04:29 -05:00
commit 79fa957d02
4 changed files with 39 additions and 16 deletions

View file

@ -42,17 +42,17 @@ var dropCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
log := args[0]
title := args[1]
ms := models.Metas{}
ms := &models.Metas{}
if len(j.RawMessage) > 8 {
err := json.Unmarshal([]byte(j.RawMessage), &ms)
err := json.Unmarshal([]byte(j.RawMessage), ms)
if err != nil {
return err
}
}
for k, v := range fields {
ms = append(ms, models.Meta{k, tools.ParseString(v)})
ms.AppendTo(k, tools.ParseString(v))
}
e := models.Entry{title, d.t, ms}
e := models.Entry{title, d.t, *ms}
l := models.Log{log, []models.Entry{e}}
err := files.Append(l)
if err != nil {