mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Move name and configKey values from widget to settings
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const configKey = "clocks"
|
||||
|
||||
type colors struct {
|
||||
rows struct {
|
||||
even string
|
||||
@@ -23,11 +25,11 @@ type Settings struct {
|
||||
sort string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods.clocks")
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
||||
|
||||
dateFormat: localConfig.UString("dateFormat", wtf.SimpleDateFormat),
|
||||
timeFormat: localConfig.UString("timeFormat", wtf.SimpleTimeFormat),
|
||||
|
||||
@@ -19,7 +19,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "World Clocks", "clocks", false),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common.Name, settings.common.ConfigKey, false),
|
||||
|
||||
settings: settings,
|
||||
dateFormat: settings.dateFormat,
|
||||
|
||||
Reference in New Issue
Block a user