diff options
author | Sean E. Russell <ser@ser1.net> | 2020-04-27 13:53:45 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-04-27 13:53:45 -0500 |
commit | b7d65b758775a7c9c74098602555f2d1454c2633 (patch) | |
tree | 60d3a583085a6ba2dcead5a8dddf4afbc03a35f8 /devices | |
parent | 6bad48b7a16569ea3c2d8e18a705a5f0ad90d8ec (diff) |
Change from docopt to pflag to support extensions having options
Diffstat (limited to 'devices')
-rw-r--r-- | devices/devices.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/devices/devices.go b/devices/devices.go index 4a029cd..81b0521 100644 --- a/devices/devices.go +++ b/devices/devices.go @@ -1,6 +1,8 @@ package devices -import "log" +import ( + "log" +) const ( Temperatures = "Temperatures" // Device domain for temperature sensors @@ -20,6 +22,22 @@ func RegisterShutdown(f func() error) { _shutdownFuncs = append(_shutdownFuncs, f) } +/* +func RegisterStartup(f func(gotop.Config)) { + if _startup == nil { + _startup = make([]func(gotop.Config), 1) + } + _startup = append(_startup, f) +} + +// Called after configuration has been parsed +func Startup(c gotop.Config) { + for _, f := range _startup { + f(c) + } +} +*/ + // Shutdown will be called by the `main()` function if gotop is exited // cleanly. It will call all of the registered shutdown functions of devices, // logging all errors but otherwise not responding to them. |