Drop the icon sample row; give tool panes a working PATH and a reason to stay open; answer the open questions

This commit is contained in:
Sam
2026-11-10 18:35:11 +11:00
parent 4a23f05d20
commit 7b12b45064
11 changed files with 499 additions and 9 deletions

View File

@@ -36,7 +36,9 @@ var tools = []tool{
{"yazi", "yazi", "files"},
{"nvim", "nvim", "editing one file"},
{"fzf", "fzf", "picking anything"},
{"ocr", "ocr review", "the review of the current change, in the terminal"},
// A review that finds nothing exits in a second, which looks like a broken
// pane. It is given a last line so the output can be read before closing.
{"ocr", "ocr review --color never; printf '\\npress enter to close\\n'; read -r _", "the review of the current change"},
}
// currentWorkspace finds the workspace this program is drawn in. TUIOS knows;
@@ -96,8 +98,13 @@ func openTool(folder, name string) error {
}
log, _ := os.Create(filepath.Join(os.TempDir(), "paperclip-harness-tool.log"))
// A pane started this way gets a smaller PATH than an interactive shell, so
// the places a person's tools actually live are put back before the tool
// runs. Without this, ocr is "command not found" inside its own pane.
prelude := `export PATH="$HOME/.local/bin:$HOME/.nix-profile/bin:` +
`/run/current-system/sw/bin:/etc/profiles/per-user/$USER/bin:$PATH"; `
cmd := exec.Command("tuios", "new-window", chosen.name, "-s", session,
"--workspace", ws, "--cwd", folder, "--", "/bin/sh", "-c", chosen.command)
"--workspace", ws, "--cwd", folder, "--", "/bin/sh", "-c", prelude+chosen.command)
cmd.Stdout = log
cmd.Stderr = log
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}