From f1e2f8a241255f961d055f0b09e133ee1816b351 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 29 Dec 2024 09:50:17 +0200 Subject: use another random entry when the previous got deleted as user input --- internal/prompt/file.go | 2 +- internal/run.go | 5 +++-- internal/summary/summary.go | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/prompt/file.go b/internal/prompt/file.go index 52143fa..804d26f 100644 --- a/internal/prompt/file.go +++ b/internal/prompt/file.go @@ -53,7 +53,7 @@ func FileAction(question, content, filePath string) (string, error) { case "r", "random", "random other": return content, fmt.Errorf("%w %s", ErrRamdomOther, filePath) default: - fmt.Println("Please enter 'y' or 'n' or 'e' or 'd'.") + fmt.Println("Please respond with one of [ynedr].") } } } diff --git a/internal/run.go b/internal/run.go index b3e4a1c..813bdf6 100644 --- a/internal/run.go +++ b/internal/run.go @@ -55,12 +55,13 @@ func runPlatform(ctx context.Context, args config.Args, platform platforms.Platf return err } err = platform.Post(ctx, args, sizeLimit, en) - if errors.Is(err, prompt.ErrRamdomOther) { + if errors.Is(err, prompt.ErrRamdomOther) || errors.Is(err, prompt.ErrDeleted) { + return runPlatform(ctx, args, platform, sizeLimit) } return err } func softError(err error) bool { - return errors.Is(err, prompt.ErrAborted) || errors.Is(err, prompt.ErrDeleted) + return errors.Is(err, prompt.ErrAborted) } diff --git a/internal/summary/summary.go b/internal/summary/summary.go index 8978d66..c94f73f 100644 --- a/internal/summary/summary.go +++ b/internal/summary/summary.go @@ -30,6 +30,8 @@ func Run(ctx context.Context, args config.Args) error { return nil } +// TODO: One sub-header per month +// TODO: Header should be a 80char summary. Use LLM to generate this? func generateGemtext(entries []entry.Entry, title string) (string, error) { var sb strings.Builder -- cgit v1.2.3