summaryrefslogtreecommitdiff
path: root/internal/entry
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-31 22:27:25 +0200
committerPaul Buetow <paul@buetow.org>2024-10-31 22:27:25 +0200
commit177979b5df6336e477d5aa3cdc64b3021288bb92 (patch)
tree9b4c146b1413bf99b2fc6ec4fc58a7ab77c9cc03 /internal/entry
parent368d58e61ab3f9978c7cf51ee4c0d45263b9e5c5 (diff)
refactor
Diffstat (limited to 'internal/entry')
-rw-r--r--internal/entry/entry.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/internal/entry/entry.go b/internal/entry/entry.go
index 620c103..1fb5ce1 100644
--- a/internal/entry/entry.go
+++ b/internal/entry/entry.go
@@ -9,6 +9,7 @@ import (
"strings"
"time"
+ "codeberg.org/snonux/gos/internal/oi"
"codeberg.org/snonux/gos/internal/prompt"
"codeberg.org/snonux/gos/internal/timestamp"
)
@@ -104,12 +105,8 @@ func New(filePath string) (Entry, error) {
}
func (e *Entry) Content() (string, []string, error) {
- bytes, err := os.ReadFile(e.Path)
- if err != nil {
- return "", []string{}, err
- }
- content := strings.TrimSpace(string(bytes))
- return content, extractURLs(content), nil
+ content, err := oi.SlurpAndTrim(e.Path)
+ return content, extractURLs(content), err
}
func (e Entry) ContentWithLimit(sizeLimit int) (string, []string, error) {