lune

created pr with 124.1 on 2026-04-22T02:46:44Z · by 613b58b7
changed status to closed on 2026-06-21T16:45:31Z · by 66ddd677
Closing as superceded by 126
cmds
checkout latest patchset:
ssh pr.pico.sh print 124 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 124.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 124
set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 124
set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 124

Patchset 124.1 on 2026-04-22T02:46:44Z · commit a698e7f

listing real name of tasks
juan 2026-04-21T03:21:16Z
construction of db for management of decrypted names of tasks
juan 2026-04-21T05:43:09Z
fix UTF8 chracteres
juan 2026-04-21T21:13:24Z
filter by status and coloring types of status
juan 2026-04-21T21:18:53Z
update help
juan 2026-04-21T21:21:36Z
list areas names
juan 2026-04-21T21:44:53Z
adjust table tasks to truncate name and list area
juan 2026-04-21T21:56:40Z
partial implementation of listing tasks by areas
juan 2026-04-21T22:05:20Z
final implementation of listing tasks by areas with UTF-8 chracteres
juan 2026-04-21T22:10:20Z
sort on task list to show first do now
juan 2026-04-21T22:33:29Z
update with 8 char of id and db.go
juan 2026-04-21T23:27:54Z
partial implementation of TUI menu on task update
juan 2026-04-21T23:35:35Z
task name correcion on TUI menu of Update task
juan 2026-04-21T23:38:19Z
TUI menu for update task with others flags
juan 2026-04-21T23:43:02Z
helper for TUI update task
juan 2026-04-21T23:49:56Z
search by first 8 char of note id for editing it
juan 2026-04-22T00:00:17Z
partial implementation on note TUI menu for update
juan 2026-04-22T00:05:46Z
TUI menu notebook just with tags
juan 2026-04-22T00:20:55Z
Note update now let you insert only the first 8 char of notebook id in update
juan 2026-04-22T00:25:53Z
implementation of (lune note notebook-list) for listing all notebooks and its ID
juan 2026-04-22T01:10:51Z
partial implementation of lune note show-content ID
juan 2026-04-22T02:01:11Z
convert \n in new line and \ in space for lune note show-content ID
juan 2026-04-22T02:18:42Z
+1 -0 cmd/note/note.go #
......@@ -19,6 +19,7 @@ func init() {
1919 Cmd.AddCommand(ListCmd)
2020 Cmd.AddCommand(NotebookListCmd)
2121 Cmd.AddCommand(ShowCmd)
22+ Cmd.AddCommand(ShowContentCmd)
2223 Cmd.AddCommand(UpdateCmd)
2324 Cmd.AddCommand(DeleteCmd)
2425 }
+37 -0 cmd/note/show_content.go #
......@@ -0,0 +1,37 @@
1+// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2+//
3+// SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+package note
6+
7+import (
8+ "fmt"
9+
10+ "git.secluded.site/lune/internal/db"
11+ "github.com/spf13/cobra"
12+)
13+
14+// ShowContentCmd displays a note's content by ID.
15+var ShowContentCmd = &cobra.Command{
16+ Use: "show-content ID",
17+ Short: "Show note content",
18+ Long: `Retrieve and print the content of a note from your local database.
19+
20+Requires master password configuration and local DB support enabled.`,
21+ Args: cobra.ExactArgs(1),
22+ RunE: runShowContent,
23+ SilenceUsage: true,
24+}
25+
26+func runShowContent(cmd *cobra.Command, args []string) error {
27+ idInput := args[0]
28+ id := db.CompleteID(idInput)
29+
30+ content, err := db.GetNoteContent(id)
31+ if err != nil {
32+ return err
33+ }
34+
35+ fmt.Fprintln(cmd.OutOrStdout(), content)
36+ return nil
37+}
+36 -0 internal/db/reader.go #
......@@ -8,6 +8,7 @@ import (
88 "bytes"
99 "encoding/binary"
1010 "encoding/json"
11+ "fmt"
1112 "os"
1213 "path/filepath"
1314 "regexp"
......@@ -147,6 +148,41 @@ func EnrichTask(taskID string) (string, error) {
147148 return nameCache[taskID], nil
148149 }
149150
151+// GetNoteContent retrieves the content of a note from the local database.
152+func GetNoteContent(noteID string) (string, error) {
153+ dbPath := GetDefaultPath()
154+ if _, err := os.Stat(dbPath); os.IsNotExist(err) {
155+ return "", fmt.Errorf("local database not found")
156+ }
157+
158+ o := &opt.Options{
159+ Comparer: idbComparer{},
160+ ReadOnly: true,
161+ }
162+
163+ db, err := leveldb.OpenFile(dbPath, o)
164+ if err != nil {
165+ return "", err
166+ }
167+ defer db.Close()
168+
169+ iter := db.NewIterator(nil, nil)
170+ defer iter.Release()
171+
172+ for iter.Next() {
173+ val := iter.Value()
174+ if bytes.Contains(val, []byte(noteID)) {
175+ // Extract content using regex
176+ re := regexp.MustCompile(`"content"\s*:\s*"([^"]+)"`)
177+ matches := re.FindSubmatch(val)
178+ if len(matches) > 1 {
179+ return cleanName(string(matches[1])), nil
180+ }
181+ }
182+ }
183+ return "", fmt.Errorf("content not found for note ID: %s", noteID)
184+}
185+
150186 // CompleteID searches for the full UUID by an 8-character prefix.
151187 func CompleteID(prefix string) string {
152188 if len(prefix) != 8 {
Back to top