mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Unknown extracted to new config format
This commit is contained in:
parent
4b3f957c61
commit
6f98ecccf7
3
main.go
3
main.go
@ -316,7 +316,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
||||
settings := zendesk.NewSettingsFromYAML(wtf.Config)
|
||||
widget = zendesk.NewWidget(app, settings)
|
||||
default:
|
||||
widget = unknown.NewWidget(app, widgetName)
|
||||
settings := unknown.NewSettingsFromYAML(wtf.Config)
|
||||
widget = unknown.NewWidget(app, widgetName, settings)
|
||||
}
|
||||
|
||||
return widget
|
||||
|
18
modules/unknown/settings.go
Normal file
18
modules/unknown/settings.go
Normal file
@ -0,0 +1,18 @@
|
||||
package unknown
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
@ -9,11 +9,15 @@ import (
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, name string) *Widget {
|
||||
func NewWidget(app *tview.Application, name string, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, name, name, false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
return &widget
|
||||
@ -22,7 +26,6 @@ func NewWidget(app *tview.Application, name string) *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
|
||||
widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s", widget.Name())))
|
||||
widget.View.Clear()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user