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 (
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
numberOfResults int `help:"Number of results to show. Default is 10." optional:"true"`
|
||||
clientId string `help:"Client Id (default is env var TWITCH_CLIENT_ID)"`
|
||||
@@ -33,7 +33,8 @@ func defaultLanguage() []interface{} {
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
twitch := ymlConfig.UString("twitch")
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, twitch, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, twitch, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
numberOfResults: ymlConfig.UInt("numberOfResults", 10),
|
||||
clientId: ymlConfig.UString("clientId", os.Getenv("TWITCH_CLIENT_ID")),
|
||||
languages: utils.ToStrs(ymlConfig.UList("languages", defaultLanguage())),
|
||||
|
||||
@@ -29,7 +29,7 @@ type Stream 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,
|
||||
twitch: NewClient(settings.clientId),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user