mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Simplify the inclusion of the Common config settings into each module
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -11,7 +11,8 @@ const (
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
cpuCombined bool
|
||||
showCPU bool
|
||||
showMem bool
|
||||
@@ -20,7 +21,8 @@ type Settings struct {
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
cpuCombined: ymlConfig.UBool("cpuCombined", false),
|
||||
showCPU: ymlConfig.UBool("showCPU", true),
|
||||
showMem: ymlConfig.UBool("showMem", true),
|
||||
|
||||
@@ -23,7 +23,7 @@ type Widget struct {
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: view.NewBarGraph(app, settings.common.Name, settings.common),
|
||||
BarGraph: view.NewBarGraph(app, settings.Name, settings.Common),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
|
||||
Reference in New Issue
Block a user