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 5f57edb212 Even more help settings
Blitz through g
Clean up a setting that no longer exists for gcal
2019-07-04 11:40:53 -04:00

57 lines
3.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package gcal
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Calendar"
type colors struct {
day string
description string `help:"The default color for calendar event descriptions." values:"Any X11 color name." optional:true`
past string `help:"The color for calendar events that have passed." values:"Any X11 color name." optional:true`
title string `help:"The default colour for calendar event titles." values:"Any X11 color name." optional:true`
highlights []interface{} `help:"A list of arrays that define a regular expression pattern and a color. If a calendar event title matches a regular expression, the title will be drawn in that colour. Over-rides the default title colour." values:"An array of a valid regular expression, any X11 color name." optional:true`
}
type Settings struct {
colors
common *cfg.Common
conflictIcon string `help:"The icon displayed beside calendar events that have conflicting times (they intersect or overlap in some way)." values:"Any displayable unicode character." optional:true`
currentIcon string `help:"The icon displayed beside the current calendar event." values:"Any displayable unicode character." optional:true`
displayResponseStatus bool `help:"Whether or not to display your response status to the calendar event." values:"true or false" optional:true`
email string `help:"The email address associated with your Google account. Necessary for determining 'responseStatus'." values:"A valid email address string."`
eventCount int `help:"The number of calendar events to display." values:"A positive integer, 0..n." optional:true`
multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:true`
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
showDeclined bool `help:"Whether or not to display events youve declined to attend." values:"true or false" optional:true`
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
}
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),
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
}