feat: Task 16 — SSH Session Tab (multi-session)

- pkg/tui/session.go — SessionTab with live SSH terminal in a tab
- pkg/tui/messages.go — quitMsg, openSessionMsg, sessionOutputMsg
- pkg/tui/tabs.go — Tab.Close() interface, Add() returns tea.Cmd
- pkg/tui/host_list_tab.go — Enter opens session tab, q quits
- pkg/tui/tui.go — handle openSessionMsg/quitMsg, SetDataDir
- cmd/hostkeeper/tui.go — pass dataDir to model
This commit is contained in:
swanadiva
2026-06-23 14:54:44 +07:00
parent 5d9e38f8db
commit 98dfc1c79c
6 changed files with 432 additions and 5 deletions
+12 -1
View File
@@ -56,7 +56,15 @@ func (t *HostListTab) Update(msg tea.Msg) (Tab, tea.Cmd) {
case "enter", " ":
if len(t.hosts) > 0 {
return t, tea.Quit
host := t.hosts[t.selectedIndex]
return t, func() tea.Msg {
return openSessionMsg{host: host}
}
}
case "q", "ctrl+c":
return t, func() tea.Msg {
return quitMsg{}
}
}
}
@@ -89,6 +97,9 @@ func (t *HostListTab) View() string {
return b.String()
}
// Close is a no-op for host list tab
func (t *HostListTab) Close() {}
// SetHosts sets the host list
func (t *HostListTab) SetHosts(hosts []*models.Host) {
t.hosts = hosts