diff options
Diffstat (limited to 'devices/devices.go')
-rw-r--r-- | devices/devices.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/devices/devices.go b/devices/devices.go index 91a8815..efdc404 100644 --- a/devices/devices.go +++ b/devices/devices.go @@ -2,7 +2,13 @@ package devices import "log" +const ( + Temperatures = "Temperatures" +) + +var Domains []string = []string{Temperatures} var shutdownFuncs []func() error +var _devs map[string][]string // RegisterShutdown stores a function to be called by gotop on exit, allowing // extensions to properly release resources. Extensions should register a @@ -24,3 +30,18 @@ func Shutdown() { } } } + +func RegisterDeviceList(typ string, f func() []string) { + if _devs == nil { + _devs = make(map[string][]string) + } + if ls, ok := _devs[typ]; ok { + _devs[typ] = append(ls, f()...) + return + } + _devs[typ] = f() +} + +func Devices(domain string) []string { + return _devs[domain] +} |