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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user