Author:
Hash:
Timestamp:
+15 -1 +/-1 browse
Kevin Schoon [me@kevinschoon.com]
a7bc420411e92702df666438d4bc22c4e547c6f5
Mon, 27 Nov 2023 14:20:17 +0000 (1.9 years ago)
| 1 | diff --git a/pkg/cmd/app.go b/pkg/cmd/app.go |
| 2 | index 95add41..905134a 100644 |
| 3 | --- a/pkg/cmd/app.go |
| 4 | +++ b/pkg/cmd/app.go |
| 5 | @@ -26,6 +26,15 @@ func today() string { |
| 6 | return fmt.Sprintf("/daily/%d-%d-%d", year, day, int(month)) |
| 7 | } |
| 8 | |
| 9 | + func printNote(note *hierarchy.Note, all bool) { |
| 10 | + fmt.Println(note.Content) |
| 11 | + if all { |
| 12 | + for i := 0; i < len(note.Descendants); i++ { |
| 13 | + printNote(note.Descendants[i], all) |
| 14 | + } |
| 15 | + } |
| 16 | + } |
| 17 | + |
| 18 | func New() *cli.App { |
| 19 | cfg := config.Default() |
| 20 | app := cli.NewApp() |
| 21 | @@ -176,6 +185,11 @@ data structure. It uses SQLite to store note content and metadata. |
| 22 | Aliases: []string{"e"}, |
| 23 | Usage: "output format", |
| 24 | }, |
| 25 | + &cli.BoolFlag{ |
| 26 | + Name: "all", |
| 27 | + Aliases: []string{"a"}, |
| 28 | + Usage: "output all desendant notes in the hierarchy", |
| 29 | + }, |
| 30 | }, |
| 31 | Action: func(ctx *cli.Context) error { |
| 32 | path := ctx.Args().First() |
| 33 | @@ -186,7 +200,7 @@ data structure. It uses SQLite to store note content and metadata. |
| 34 | if err != nil { |
| 35 | return err |
| 36 | } |
| 37 | - fmt.Println(note.Content) |
| 38 | + printNote(note, ctx.Bool("all")) |
| 39 | return nil |
| 40 | }, |
| 41 | }, |