summaryrefslogtreecommitdiff
path: root/cmd/hexai-tmux-edit/main.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-16 03:10:55 +0200
committerPaul Buetow <paul@buetow.org>2026-03-16 03:10:55 +0200
commit1fc1611fa99993cab5dc8bf0844183285296e3b2 (patch)
treec5c9b8b5abac5b5d4c0d56ed90b0580184cc4383 /cmd/hexai-tmux-edit/main.go
parent12090f25a3677291863dbb80277bdad3eaec0324 (diff)
Release v0.24.0v0.24.0
Bring unit test coverage from ~75% to 85.1% project-wide. All internal packages now exceed 80% coverage. Refactored cmd entrypoints to extract testable run() functions with injectable seams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'cmd/hexai-tmux-edit/main.go')
-rw-r--r--cmd/hexai-tmux-edit/main.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/cmd/hexai-tmux-edit/main.go b/cmd/hexai-tmux-edit/main.go
index ea3330b..6d0e75e 100644
--- a/cmd/hexai-tmux-edit/main.go
+++ b/cmd/hexai-tmux-edit/main.go
@@ -21,6 +21,9 @@ import (
"codeberg.org/snonux/hexai/internal/tmuxedit"
)
+// runTmuxEdit is the seam for testing: override in tests to avoid real tmux.
+var runTmuxEdit = tmuxedit.Run
+
func main() {
defaultPath := appconfig.DefaultConfigPath()
configPath := flag.String("config", "", fmt.Sprintf("path to config file (default: %s)", defaultPath))
@@ -28,13 +31,19 @@ func main() {
pane := flag.String("pane", "", "tmux target pane ID (e.g. %%5)")
flag.Parse()
- opts := tmuxedit.Options{
- ConfigPath: strings.TrimSpace(*configPath),
- Agent: strings.TrimSpace(*agent),
- Pane: strings.TrimSpace(*pane),
- }
- if err := tmuxedit.Run(opts); err != nil {
+ opts := buildOptions(*configPath, *agent, *pane)
+ if err := runTmuxEdit(opts); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
+
+// buildOptions constructs tmuxedit.Options from the parsed flag values,
+// trimming whitespace from each field.
+func buildOptions(configPath, agent, pane string) tmuxedit.Options {
+ return tmuxedit.Options{
+ ConfigPath: strings.TrimSpace(configPath),
+ Agent: strings.TrimSpace(agent),
+ Pane: strings.TrimSpace(pane),
+ }
+}