From a35f0ed04c28d80b902a00c3aec84dd86db34e85 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 3 Jan 2025 10:12:02 +0200 Subject: add warning when there is no hashtag --- internal/colour/colour.go | 2 ++ internal/entry/entry.go | 2 +- internal/queue/queue.go | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/colour/colour.go b/internal/colour/colour.go index 54cb1d9..b5f2681 100644 --- a/internal/colour/colour.go +++ b/internal/colour/colour.go @@ -14,5 +14,7 @@ var ( Info2f = info2Col.PrintfFunc() SInfo2f = info2Col.SprintfFunc() Ackf = color.New(color.FgBlack, color.BgHiYellow, color.Bold).PrintfFunc() + warnCol = color.New(color.FgHiWhite, color.BgRed) + Warnf = warnCol.PrintfFunc() Successf = color.New(color.FgWhite, color.BgGreen).PrintfFunc() ) diff --git a/internal/entry/entry.go b/internal/entry/entry.go index 600dbc4..509ddfe 100644 --- a/internal/entry/entry.go +++ b/internal/entry/entry.go @@ -193,7 +193,7 @@ func (en Entry) Remove() error { } func (en Entry) FileAction(question string) error { - content, _, err := en.Content() + content, err := oi.SlurpAndTrim(en.Path) if err != nil { return err } diff --git a/internal/queue/queue.go b/internal/queue/queue.go index 33b5bf7..43a017c 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -50,10 +50,10 @@ func queueEntries(args config.Args) error { return err } if !hasHashtags { - if err := en.FileAction("Do you want to queue this despite there are no Hashtags?"); err != nil { - return err - } - } else if en.HasTag("ask") { + colour.Warnf("The following entry has got no hashtags:") + fmt.Printf("\n") + } + if !hasHashtags || en.HasTag("ask") { if err := en.FileAction("Do you want to queue this"); err != nil { return err } -- cgit v1.2.3