mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Have the modules set their own titles If no title is specified, use this title, rather than default to name
59 lines
1.7 KiB
Go
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
|
|
}
|