♻️ Get rid of PartialEntry
This commit is contained in:
parent
7e54d6e46c
commit
820a2de269
5 changed files with 111 additions and 57 deletions
|
|
@ -42,18 +42,17 @@ var dropCmd = &cobra.Command{
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
log := args[0]
|
||||
title := args[1]
|
||||
e := models.PartialEntry()
|
||||
ms := models.Metas{}
|
||||
if len(j.RawMessage) > 8 {
|
||||
err := json.Unmarshal([]byte(j.RawMessage), &e)
|
||||
err := json.Unmarshal([]byte(j.RawMessage), &ms)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for k, v := range fields {
|
||||
e.Fields = append(e.Fields, models.Meta{k, tools.ParseString(v)})
|
||||
ms = append(ms, models.Meta{k, tools.ParseString(v)})
|
||||
}
|
||||
e.Title = title
|
||||
e.Date = d.t
|
||||
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