summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-12-29 09:50:17 +0200
committerPaul Buetow <paul@buetow.org>2024-12-29 09:50:17 +0200
commitf1e2f8a241255f961d055f0b09e133ee1816b351 (patch)
tree632a0a6828a500d1156a4bc66fef85d64f5e9ed6
parent03ed103a69b6b6c2f822706e2d0f00759a4b448b (diff)
use another random entry when the previous got deleted as user input
-rw-r--r--internal/prompt/file.go2
-rw-r--r--internal/run.go5
-rw-r--r--internal/summary/summary.go2
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