mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Closes #37. Help into Git and Github modules
This commit is contained in:
@@ -47,8 +47,9 @@ func Fetch() (*calendar.Events, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t := fromMidnight().Format(time.RFC3339)
|
||||
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(int64(Config.UInt("wtf.mods.gcal.eventCount", 10))).OrderBy("startTime").Do()
|
||||
startTime := fromMidnight().Format(time.RFC3339)
|
||||
eventLimit := int64(Config.UInt("wtf.mods.gcal.eventCount", 10))
|
||||
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(startTime).MaxResults(eventLimit).OrderBy("startTime").Do()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -79,10 +79,11 @@ func (widget *Widget) contentFrom(events *calendar.Events) string {
|
||||
conflict := widget.conflicts(event, events)
|
||||
|
||||
str = str + fmt.Sprintf(
|
||||
"%s [%s]%s[white]\n [%s]%s %s[white]\n\n",
|
||||
"%s [%s]%s[white]\n %s[%s]%s %s[white]\n\n",
|
||||
widget.dayDivider(event, prevEvent),
|
||||
widget.titleColor(event),
|
||||
widget.eventSummary(event, conflict),
|
||||
widget.location(event),
|
||||
widget.descriptionColor(event),
|
||||
widget.eventTimestamp(event),
|
||||
widget.until(event),
|
||||
@@ -176,6 +177,22 @@ func (widget *Widget) titleColor(event *calendar.Event) string {
|
||||
return color
|
||||
}
|
||||
|
||||
func (widget *Widget) location(event *calendar.Event) string {
|
||||
if Config.UBool("wtf.mods.gcal.withLocation", true) == false {
|
||||
return ""
|
||||
}
|
||||
|
||||
if event.Location == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"[%s]%s\n ",
|
||||
widget.descriptionColor(event),
|
||||
event.Location,
|
||||
)
|
||||
}
|
||||
|
||||
// until returns the number of hours or days until the event
|
||||
// If the event is in the past, returns nil
|
||||
func (widget *Widget) until(event *calendar.Event) string {
|
||||
|
||||
Reference in New Issue
Block a user