Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tabell committed Jan 15, 2024
1 parent 14888c5 commit 75106dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 3 additions & 8 deletions modules/ping/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ const (
)

type Target struct {
Name string
Host string
Up bool
Latency int
Name string `help: "Name: The label to use for the host you want to ping"`
Host string `help: "Host: IP address or hostname to ping"`
Up bool // not meant to be set by user
}

// Settings defines the configuration properties for this module
type Settings struct {
common *cfg.Common
targets []Target

// Define your settings attributes here
}

// NewSettingsFromYAML creates a new settings instance from a YAML config block
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
Expand Down
6 changes: 4 additions & 2 deletions modules/ping/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ping

import (
"fmt"
"log"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -54,17 +55,18 @@ func (widget *Widget) doPings() {
} else {
widget.targets[idx].Up = false
}
} else {
log.Fatalf("error sending ping: %v", err)
}
}

}()
}
wg.Wait()
}
// Refresh updates the onscreen contents of the widget
func (widget *Widget) Refresh() {

widget.doPings()
// The last call should always be to the display function
widget.display()
}

Expand Down

0 comments on commit 75106dd

Please sign in to comment.