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
|
||||
|
||||
bearerToken string
|
||||
consumerKey string
|
||||
@@ -24,7 +24,7 @@ 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),
|
||||
|
||||
bearerToken: ymlConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
|
||||
consumerKey: ymlConfig.UString("consumerKey", os.Getenv("WTF_TWITTER_CONSUMER_KEY")),
|
||||
|
||||
@@ -22,8 +22,8 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "screenName", "screenNames"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "screenName", "screenNames"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
|
||||
idx: 0,
|
||||
settings: settings,
|
||||
@@ -63,7 +63,7 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
}
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.PaginationMarker(len(widget.Sources), widget.Idx, width-2) + "\n"
|
||||
str := widget.settings.PaginationMarker(len(widget.Sources), widget.Idx, width-2) + "\n"
|
||||
for _, tweet := range tweets {
|
||||
str += widget.format(tweet)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user