Cleanup pane, Pi session tools, review from the UI, project registry, needs panel acts
This commit is contained in:
@@ -39,6 +39,8 @@ var tools = []tool{
|
||||
// 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"},
|
||||
{"pi sessions", "yazi ~/.pi/paperclips", "every Pi conversation Paperclip has recorded"},
|
||||
{"pi resume", "pi --resume", "Pi's own list of sessions; pick one and read it"},
|
||||
}
|
||||
|
||||
// currentWorkspace finds the workspace this program is drawn in. TUIOS knows;
|
||||
@@ -185,3 +187,31 @@ func fieldNumber(obj, name string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// switchWorkspace shows a workspace by name. It is how one pane can hand you to
|
||||
// another without any message passing: the name is the address.
|
||||
func switchWorkspace(name string) error {
|
||||
session, _, err := currentWorkspace()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := exec.Command("tuios", "list-workspaces", "-s", session, "--json").Output()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var doc struct {
|
||||
Workspaces []struct {
|
||||
Workspace int `json:"workspace"`
|
||||
Name string `json:"name"`
|
||||
} `json:"workspaces"`
|
||||
}
|
||||
if err := json.Unmarshal(out, &doc); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, w := range doc.Workspaces {
|
||||
if w.Name == name {
|
||||
return exec.Command("tuios", "select-workspace", strconv.Itoa(w.Workspace), "-s", session).Run()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("no workspace called %q", name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user