title, type, tags, sources, last_updated
| title |
type |
tags |
sources |
last_updated |
| GOG CLI 工具 |
synthesis |
| Google Workspace |
| CLI工具 |
| Gmail |
| Calendar |
| Drive |
|
|
2026-04-15 |
概述
GOG CLI(Google Workspace CLI)是由 steipete 开发的 macOS/Linux 命令行工具,通过 OAuth 为 Gmail、Google Calendar、Google Drive、Google Contacts、Google Sheets、Google Docs 提供命令行接口。
支持的 Google 服务
| 服务 |
支持功能 |
| Gmail |
搜索(threads/messages)、发送(普通/HTML/回复)、草稿创建与发送 |
| Calendar |
列表、创建、更新事件,支持颜色标记(11色) |
| Drive |
文件搜索 |
| Contacts |
联系人列表 |
| Sheets |
读取、更新、追加、清除、元数据查询 |
| Docs |
导出(txt)、读取内容(cat) |
认证方式
- 通过
gog auth credentials /path/to/client_secret.json 配置 OAuth 客户端
- 通过
gog auth add <email> --services gmail,calendar,drive,contacts,docs,sheets 授权所需服务
- 支持多账户:
--account <email> 参数切换
核心命令示例
Gmail
Calendar
Sheets
Docs
环境变量
GOG_ACCOUNT=you@gmail.com — 避免每次重复 --account 参数
注意事项
- 发送邮件或创建事件前需二次确认
- Sheets 值传递推荐使用
--values-json
--body 参数不解析 \n,多行内容需用 --body-file
- Docs 不支持原地编辑,需通过 Docs API 客户端实现
安装