1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/modules/gcal/settings.go
Sean Smith 14abd422b2 Add default titles, to mimic original behavior
Have the modules set their own titles
If no title is specified, use this title, rather than default to name
2019-04-30 23:38:37 -04:00

59 lines
1.7 KiB
Go

package gcal
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Calendar"
type colors struct {
day string
description string
past string
title string
highlights []interface{}
}
type Settings struct {
colors
common *cfg.Common
conflictIcon string
currentIcon string
displayResponseStatus bool
email string
eventCount int
multiCalendar bool
secretFile string
showDeclined bool
textInterval int
withLocation bool
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
currentIcon: ymlConfig.UString("currentIcon", "🔸"),
displayResponseStatus: ymlConfig.UBool("displayResponseStatus", true),
email: ymlConfig.UString("email", ""),
eventCount: ymlConfig.UInt("eventCount", 10),
multiCalendar: ymlConfig.UBool("multiCalendar", false),
secretFile: ymlConfig.UString("secretFile", ""),
showDeclined: ymlConfig.UBool("showDeclined", false),
textInterval: ymlConfig.UInt("textInterval", 30),
withLocation: ymlConfig.UBool("withLocation", true),
}
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
settings.colors.description = ymlConfig.UString("colors.description", "white")
settings.colors.past = ymlConfig.UString("colors.past", "gray")
settings.colors.title = ymlConfig.UString("colors.title", "white")
return &settings
}