1
0
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:
Chris Cummer
2020-11-26 19:53:21 -08:00
parent f9a06540f1
commit d6a0797bf2
161 changed files with 378 additions and 330 deletions

View File

@@ -13,7 +13,7 @@ const (
)
type Settings struct {
common *cfg.Common
*cfg.Common
bearerToken string
consumerKey string
@@ -23,7 +23,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")),

View File

@@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
TextWidget: view.NewTextWidget(app, nil, settings.common),
TextWidget: view.NewTextWidget(app, nil, settings.Common),
client: NewClient(settings),
settings: settings,
@@ -37,7 +37,7 @@ func (widget *Widget) content() (string, string, bool) {
// Add header row
str := fmt.Sprintf(
"[%s]%-12s %10s %8s[white]\n",
widget.settings.common.Colors.Subheading,
widget.settings.Colors.Subheading,
"Username",
"Followers",
"Tweets",