使用 gog CLI 工具管理 Google 日历,支持创建、列出、更新、删除日历事件,具备颜色标记、OAuth 认证和脚本化能力。
Manage Google Calendar events efficiently using the gog command-line tool.
bash
brew install steipete/tap/gogcli
bash
# Set up OAuth credentials
gog auth credentials /path/to/client_secret.json
# Add your Google account with calendar access
gog auth add you@gmail.com --services calendar
# Verify authentication
gog auth list
bash
# List events from primary calendar (today's events)
gog calendar events primary --from "2026-01-01T00:00:00Z" --to "2026-01-01T23:59:59Z"
# List events for next 7 days
gog calendar events primary --from "$(date -u +%Y-%m-%dT00:00:00Z)" --to "$(date -u -v+7d +%Y-%m-%dT23:59:59Z)"
bash
# Create a basic event
gog calendar create primary --summary "Team Meeting" --from "2026-01-15T14:00:00+01:00" --to "2026-01-15T15:00:00+01:00"
# Create with color
gog calendar create primary --summary "Important Deadline" --from "2026-01-20T00:00:00+01:00" --to "2026-01-20T23:59:59+01:00" --event-color 11
bash
# Update event title and color
gog calendar update primary <eventId> --summary "Updated Meeting Title" --event-color 4
Color IDHex CodeTypical Use1#a4bdfcMeetings, Work2#7ae7bfPersonal, Health3#dbadffSocial, Events4#ff887cDeadlines, Urgent5#fbd75bReminders6#ffb878Travel7#46d6dbFun, Leisure8#e1e1e1General9#5484edWork Projects10#51b749Completed, Done11#dc2127Critical, High Prioritybash
# View all colors
gog calendar colors
bash
# List all events to visualize availability
gog calendar events primary --from "2026-01-15T00:00:00Z" --to "2026-01-21T23:59:59Z" --json
Note: gog CLI doesn't support direct recurring events, but you can script them:
bash
# Create multiple events via scripting (example)
for i in {1..5}; do
DATE=$(date -v+${i}d +%Y-%m-%d)
gog calendar create primary --summary "Daily Standup" \
--from "${DATE}T09:00:00+01:00" --to "${DATE}T09:30:00+01:00" \
--event-color 1
done
bash
# Set default account to avoid repetition
export GOG_ACCOUNT=you@gmail.com
# Then run commands without --account
gog calendar events primary --from "..." --to "..."
--json flag for machine-readable output--no-input for automated scriptsbash
#!/bin/bash
# Get this week's events
START=$(date -u -v-Monday +%Y-%m-%dT00:00:00Z)
END=$(date -u -v+Sunday +%Y-%m-%dT23:59:59Z)
gog calendar events primary --from "$START" --to "$END" --json