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:
@@ -38,15 +38,16 @@ type currency struct {
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
colors
|
||||
common *cfg.Common
|
||||
currencies map[string]*currency
|
||||
}
|
||||
|
||||
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),
|
||||
}
|
||||
|
||||
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||
|
||||
@@ -35,8 +35,9 @@ type colors struct {
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
colors
|
||||
common *cfg.Common
|
||||
|
||||
currencies map[string]interface{}
|
||||
top map[string]interface{}
|
||||
@@ -50,7 +51,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
||||
top, _ := ymlConfig.Map("top")
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
currencies: currencies,
|
||||
top: top,
|
||||
|
||||
@@ -39,15 +39,16 @@ type currency struct {
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
colors
|
||||
common *cfg.Common
|
||||
top map[string]*currency
|
||||
top map[string]*currency
|
||||
}
|
||||
|
||||
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),
|
||||
}
|
||||
|
||||
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||
|
||||
@@ -22,7 +22,7 @@ type Widget struct {
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
|
||||
priceWidget: price.NewWidget(settings.priceSettings),
|
||||
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
||||
|
||||
Reference in New Issue
Block a user