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,7 @@ const (
|
||||
|
||||
// Settings contains the settings for the subreddit view
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
subreddit string `help:"Subreddit to look at" optional:"false"`
|
||||
numberOfPosts int `help:"Number of posts to show. Default is 10." optional:"true"`
|
||||
@@ -23,7 +23,7 @@ type Settings struct {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
subreddit := ymlConfig.UString("subreddit")
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, subreddit, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, subreddit, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
numberOfPosts: ymlConfig.UInt("numberOfPosts", 10),
|
||||
sortOrder: ymlConfig.UString("sortOrder", "hot"),
|
||||
|
||||
@@ -18,7 +18,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