(ctx context.DnoteCtx, w io.Writer, noteRowIDArg string, contentOnly bool)
| 26 | ) |
| 27 | |
| 28 | func viewNote(ctx context.DnoteCtx, w io.Writer, noteRowIDArg string, contentOnly bool) error { |
| 29 | noteRowID, err := strconv.Atoi(noteRowIDArg) |
| 30 | if err != nil { |
| 31 | return errors.Wrap(err, "invalid rowid") |
| 32 | } |
| 33 | |
| 34 | db := ctx.DB |
| 35 | info, err := database.GetNoteInfo(db, noteRowID) |
| 36 | if err != nil { |
| 37 | return err |
| 38 | } |
| 39 | |
| 40 | if contentOnly { |
| 41 | output.NoteContent(w, info) |
| 42 | } else { |
| 43 | output.NoteInfo(w, info) |
| 44 | } |
| 45 | |
| 46 | return nil |
| 47 | } |