-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: extract shared calendar event listing helper #44
Copy link
Copy link
Closed
Description
Summary
today.go, week.go, events.go share nearly identical patterns for listing events.
Current State
Duplicated patterns in:
internal/cmd/calendar/today.go:39-77internal/cmd/calendar/week.go:39-79internal/cmd/calendar/events.go:49-109
All follow the same pattern:
- Create client
- Calculate time bounds
- Call
client.ListEvents() - Check for empty results
- Parse events
- Output JSON or text
Main differences:
- How time bounds are calculated
- The max results limit (50 vs 100 vs configurable)
- The header message
Proposed Solution
Extract shared helper function:
type EventListOptions struct {
CalendarID string
TimeMin time.Time
TimeMax time.Time
MaxResults int64
JSONOutput bool
Header string
}
func listAndPrintEvents(client *calendar.Client, opts EventListOptions) errorPriority
P2 - Reduces code duplication
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels