NewCmd returns a new remove command
(ctx context.DnoteCtx)
| 50 | |
| 51 | // NewCmd returns a new remove command |
| 52 | func NewCmd(ctx context.DnoteCtx) *cobra.Command { |
| 53 | cmd := &cobra.Command{ |
| 54 | Use: "find", |
| 55 | Short: "Find notes by keywords", |
| 56 | Aliases: []string{"f"}, |
| 57 | Example: example, |
| 58 | PreRunE: preRun, |
| 59 | RunE: newRun(ctx), |
| 60 | } |
| 61 | |
| 62 | f := cmd.Flags() |
| 63 | f.StringVarP(&bookName, "book", "b", "", "book name to find notes in") |
| 64 | |
| 65 | return cmd |
| 66 | } |
| 67 | |
| 68 | // noteInfo is an information about the note to be printed on screen |
| 69 | type noteInfo struct { |