lune
created pr with
124.1
changed status to
closed
Closing as superceded by 126
cmds
checkout latest patchset:
ssh pr.pico.sh print 124 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 124.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 124set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 124set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 124
Patchset
124.1
listing real name of tasks
juan
construction of db for management of decrypted names of tasks
2026-04-21T03:21:16Zjuan
fix UTF8 chracteres
2026-04-21T05:43:09Zjuan
filter by status and coloring types of status
2026-04-21T21:13:24Zjuan
update help
2026-04-21T21:18:53Zjuan
list areas names
2026-04-21T21:21:36Zjuan
adjust table tasks to truncate name and list area
2026-04-21T21:44:53Zjuan
partial implementation of listing tasks by areas
2026-04-21T21:56:40Zjuan
final implementation of listing tasks by areas with UTF-8 chracteres
2026-04-21T22:05:20Zjuan
sort on task list to show first do now
2026-04-21T22:10:20Zjuan
update with 8 char of id and db.go
2026-04-21T22:33:29Zjuan
partial implementation of TUI menu on task update
2026-04-21T23:27:54Zjuan
task name correcion on TUI menu of Update task
2026-04-21T23:35:35Zjuan
TUI menu for update task with others flags
2026-04-21T23:38:19Zjuan
helper for TUI update task
2026-04-21T23:43:02Zjuan
search by first 8 char of note id for editing it
2026-04-21T23:49:56Zjuan
partial implementation on note TUI menu for update
2026-04-22T00:00:17Zjuan
TUI menu notebook just with tags
2026-04-22T00:05:46Zjuan
Note update now let you insert only the first 8 char of notebook id in update
2026-04-22T00:20:55Zjuan
implementation of (lune note notebook-list) for listing all notebooks and its ID
2026-04-22T00:25:53Zjuan
→ partial implementation of lune note show-content ID
2026-04-22T01:10:51Zjuan
convert \n in new line and \ in space for lune note show-content ID
2026-04-22T02:01:11Zjuan
2026-04-22T02:18:42Z
partial implementation of lune note show-content ID
juan
2026-04-22T02:01:11ZSemantic diff summary
2 added,
2 modified,
0 signature changed,
0 removed
across 3 analyzed files
+1
-0
cmd/note/note.go
#
+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
#
| ... | ... | @@ -147,6 +148,41 @@ func EnrichTask(taskID string) (string, error) { | |
| 147 | 148 | return nameCache[taskID], nil | |
| 148 | 149 | } | |
| 149 | 150 | ||
| 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 | + | ||
| 150 | 186 | // CompleteID searches for the full UUID by an 8-character prefix. | |
| 151 | 187 | func CompleteID(prefix string) string { | |
| 152 | 188 | if len(prefix) != 8 { |