From 177979b5df6336e477d5aa3cdc64b3021288bb92 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 31 Oct 2024 22:27:25 +0200 Subject: refactor --- internal/entry/entry.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'internal/entry') 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) { -- cgit v1.2.3