office: say exactly what to do next; l opens lazygit and t opens the tool chooser everywhere; a remote run gets a terminal to ask in
This commit is contained in:
@@ -215,3 +215,40 @@ func switchWorkspace(name string) error {
|
||||
}
|
||||
return fmt.Errorf("no workspace called %q", name)
|
||||
}
|
||||
|
||||
// toolMenu is the chooser used by every pane that offers `t`. It lives here so
|
||||
// the board and the project screen cannot drift apart in how they list the same
|
||||
// tools.
|
||||
func toolMenu(at, width, height int) string {
|
||||
entries := make([][2]string, 0, len(tools))
|
||||
for i, t := range tools {
|
||||
mark := " "
|
||||
if i == at {
|
||||
mark = "▸ "
|
||||
}
|
||||
entries = append(entries, [2]string{mark + t.name, t.about})
|
||||
}
|
||||
return helpOverlay("open a tool pane here", entries, width, height)
|
||||
}
|
||||
|
||||
// toolPickerKeys handles the chooser and says whether the key was consumed.
|
||||
// `selected` is the tool to open, or empty.
|
||||
func toolPickerKeys(key string, at *int) (consumed bool, selected string) {
|
||||
switch key {
|
||||
case "up", "k":
|
||||
*at = max(0, *at-1)
|
||||
return true, ""
|
||||
case "down", "j":
|
||||
*at = min(len(tools)-1, *at+1)
|
||||
return true, ""
|
||||
case "g":
|
||||
*at = 0
|
||||
return true, ""
|
||||
case "G":
|
||||
*at = len(tools) - 1
|
||||
return true, ""
|
||||
case "enter":
|
||||
return true, tools[*at].name
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user