@@ -36,6 +36,7 @@ type Model struct {
3636 err error
3737 width int
3838 height int
39+ sshOnExit string
3940}
4041
4142type TickMsg time.Time
@@ -141,6 +142,10 @@ func InitialModel(hosts []SSHHost, updateInterval time.Duration) Model {
141142 }
142143}
143144
145+ func (m Model ) GetSSHOnExit () string {
146+ return m .sshOnExit
147+ }
148+
144149func (m * Model ) updateListSelection () {
145150 items := m .list .Items ()
146151 selectedMap := make (map [string ]bool )
@@ -232,6 +237,19 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
232237 } else if m .screen == ScreenOverview {
233238 m .screen = ScreenDashboard
234239 }
240+ case "s" :
241+ if m .screen == ScreenDashboard {
242+ if len (m .selectedHosts ) > 0 {
243+ currentHost := m .selectedHosts [m .currentHostIdx ]
244+ m .sshOnExit = currentHost .Name
245+ for _ , client := range m .clients {
246+ if client != nil {
247+ client .Close ()
248+ }
249+ }
250+ return m , tea .Quit
251+ }
252+ }
235253 }
236254
237255 case tea.WindowSizeMsg :
@@ -625,7 +643,7 @@ func renderDashboard(hostName string, info *SystemInfo, updateInterval time.Dura
625643 if multiHost {
626644 navHint = " | 'n' next | 't' overview"
627645 }
628- subtitle := fmt .Sprintf ("Last Updated: %s | Interval: %s%s | 'c' add hosts | 'q' quit" ,
646+ subtitle := fmt .Sprintf ("Last Updated: %s | Interval: %s%s | 's' shell | ' c' add hosts | 'q' quit" ,
629647 lastUpdate .Format ("15:04:05" ), formatInterval (updateInterval ), navHint )
630648
631649 b .WriteString (titleStyle .Render (title ))
0 commit comments