mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2025-12-06 02:48:28 +01:00
feat: auto ping after sshm turn on.
This commit is contained in:
parent
120cd6c009
commit
b43a67eb1a
@ -152,6 +152,12 @@ func RunInteractiveMode(hosts []config.SSHHost, configFile, currentVersion strin
|
||||
|
||||
// Start the application in alt screen mode for clean output
|
||||
p := tea.NewProgram(m, tea.WithAltScreen())
|
||||
|
||||
// Send initial command to start auto-ping when the program starts
|
||||
go func() {
|
||||
p.Send(autoPingMsg{})
|
||||
}()
|
||||
|
||||
_, err := p.Run()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error running TUI: %w", err)
|
||||
|
||||
@ -20,6 +20,7 @@ type (
|
||||
versionCheckMsg *version.UpdateInfo
|
||||
versionErrorMsg error
|
||||
errorMsg string
|
||||
autoPingMsg struct{}
|
||||
)
|
||||
|
||||
// startPingAllCmd creates a command to ping all hosts concurrently
|
||||
@ -145,6 +146,10 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case autoPingMsg:
|
||||
// Handle auto-ping on startup - start pinging all hosts
|
||||
return m, m.startPingAllCmd()
|
||||
|
||||
case versionCheckMsg:
|
||||
// Handle version check result
|
||||
if msg != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user