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:
@@ -13,7 +13,7 @@ const (
|
||||
|
||||
// Settings defines the configuration options for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
numberOfArticles int `help:"Number of stories to show. Default is 10" optional:"true"`
|
||||
contentTag string `help:"List articles from a specific tag. Default is empty" optional:"true"`
|
||||
@@ -24,7 +24,8 @@ type Settings struct {
|
||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||
func NewSettingsFromYAML(name string, yamlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, yamlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, yamlConfig, globalConfig),
|
||||
|
||||
numberOfArticles: yamlConfig.UInt("numberOfArticles", 10),
|
||||
contentTag: yamlConfig.UString("contentTag", ""),
|
||||
contentUsername: yamlConfig.UString("contentUsername", ""),
|
||||
|
||||
@@ -21,7 +21,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user