--- title: "gog CLI" type: entity tags: [cli, google-workspace, oauth, automation] --- ## Aliases - gogcli - gog CLI ## Definition gog CLI 是由 steipete 开发并维护的 macOS 命令行工具,通过 Google OAuth API 实现对 Google Workspace(Gmail、Google Calendar、Google Drive、Google Contacts、Google Docs、Google Sheets)的命令行管理。 ## Installation ```bash brew install steipete/tap/gogcli # 验证安装 which gog # 输出: /opt/homebrew/bin/gog ``` ## Core Services Supported | 服务 | 主要命令 | |------|---------| | Gmail | `gog gmail search`, `gog gmail send` | | Calendar | `gog calendar events`, `gog calendar create` | | Drive | `gog drive search` | | Contacts | `gog contacts list` | | Docs | `gog docs export`, `gog docs cat` | | Sheets | `gog sheets get`, `gog sheets update` | ## Authentication ```bash # 指定凭证 gog auth credentials /path/to/credentials.json # 添加账号 gog auth add ishenwei@gmail.com --services gmail,calendar,drive,contacts,docs,sheets # 查看授权 gog auth list # 撤销授权 gog auth revoke ``` ## Configuration - 凭证路径:`/Users/weishen/Library/Application Support/gogcli/credentials.json` - 默认账号:`export GOG_ACCOUNT=ishenwei@gmail.com` ## Related Concepts - [[OAuth]]:认证机制 - [[Google-Cloud-Console]]:凭证创建 - [[测试用户]]:绕过未验证应用限制 - [[API-Enablement]]:Google API 启用 - [[Gmail-API]]:Gmail 接口 - [[Calendar-API]]:日历接口 - [[Drive-API]]:云端硬盘接口 ## Related Entities - [[steipete-tap/gogcli]]:官方 Homebrew Tap - [[Google]]:服务提供方 - [[Homebrew]]:安装工具 ## References - 官网:https://gogcli.sh - GitHub:https://github.com/steipete/gogcli