summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-19 09:05:29 +0200
committerPaul Buetow <paul@buetow.org>2026-03-19 09:05:29 +0200
commit0918aad469ac2ff5513a7131661f1106e5ec851c (patch)
tree90ecf1245c1d98ec5e3c8ead77978206f2e61155 /internal/hexaiaction/run.go
parent31394385e72dd3a317585838ed1696076043cc60 (diff)
Improve actionable error guidance
Diffstat (limited to 'internal/hexaiaction/run.go')
-rw-r--r--internal/hexaiaction/run.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/hexaiaction/run.go b/internal/hexaiaction/run.go
index f34a4cd..2a3ade1 100644
--- a/internal/hexaiaction/run.go
+++ b/internal/hexaiaction/run.go
@@ -38,7 +38,7 @@ func logTmuxActionError(stderr io.Writer, err error) error {
// requireInput validates that input selection is not empty.
func requireInput(sel string) error {
if strings.TrimSpace(sel) == "" {
- return fmt.Errorf("no input provided on stdin")
+ return fmt.Errorf("no input provided on stdin; pipe the selected text or pane contents into hexai-tmux-action")
}
return nil
}
@@ -193,11 +193,10 @@ func (r *Runner) Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Wri
var client chatDoer = cli
parts, err := ParseInput(stdin)
if err != nil {
- _, _ = fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: failed to read input"+logging.AnsiReset)
- return err
+ return fmt.Errorf("hexai-tmux-action: failed to read action input from stdin (pipe the selected text or pane contents into hexai-tmux-action): %w", err)
}
- if strings.TrimSpace(parts.Selection) == "" {
- return fmt.Errorf("hexai-tmux-action: no input provided on stdin")
+ if err := requireInput(parts.Selection); err != nil {
+ return fmt.Errorf("hexai-tmux-action: %w", err)
}
choice, err := chooser(cfg)
if err != nil {