✨ Some convenience methods for Metas
This commit is contained in:
parent
8086029b03
commit
79fa957d02
4 changed files with 39 additions and 16 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue