mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 System extracted to new config format
This commit is contained in:
parent
5f07cb6db4
commit
ea88f5eece
3
main.go
3
main.go
@ -286,7 +286,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
|||||||
settings := status.NewSettingsFromYAML(wtf.Config)
|
settings := status.NewSettingsFromYAML(wtf.Config)
|
||||||
widget = status.NewWidget(app, settings)
|
widget = status.NewWidget(app, settings)
|
||||||
case "system":
|
case "system":
|
||||||
widget = system.NewWidget(app, date, version)
|
settings := system.NewSettingsFromYAML(wtf.Config)
|
||||||
|
widget = system.NewWidget(app, date, version, settings)
|
||||||
case "textfile":
|
case "textfile":
|
||||||
widget = textfile.NewWidget(app, pages)
|
widget = textfile.NewWidget(app, pages)
|
||||||
case "todo":
|
case "todo":
|
||||||
|
18
modules/system/settings.go
Normal file
18
modules/system/settings.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/olebedev/config"
|
||||||
|
"github.com/wtfutil/wtf/cfg"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Settings struct {
|
||||||
|
common *cfg.Common
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||||
|
settings := Settings{
|
||||||
|
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||||
|
}
|
||||||
|
|
||||||
|
return &settings
|
||||||
|
}
|
@ -11,17 +11,19 @@ import (
|
|||||||
type Widget struct {
|
type Widget struct {
|
||||||
wtf.TextWidget
|
wtf.TextWidget
|
||||||
|
|
||||||
systemInfo *SystemInfo
|
|
||||||
Date string
|
Date string
|
||||||
Version string
|
Version string
|
||||||
|
settings *Settings
|
||||||
|
systemInfo *SystemInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application, date, version string) *Widget {
|
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: wtf.NewTextWidget(app, "System", "system", false),
|
TextWidget: wtf.NewTextWidget(app, "System", "system", false),
|
||||||
|
|
||||||
Date: date,
|
Date: date,
|
||||||
Version: version,
|
settings: settings,
|
||||||
|
Version: version,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.systemInfo = NewSystemInfo()
|
widget.systemInfo = NewSystemInfo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user