SuperAPI AI 工具集

gog-cli

办公与效率

查看项目

更新于 10-15 21:11

技能介绍

用途:gogcli(命令为 gog)是面向 Google Workspace 服务的快速、便于脚本化的命令行工具,输出以 JSON 为主并支持多账号,适合在终端或脚本中操作邮件、日历、云盘与文档等。

主要能力:覆盖 Gmail、Calendar、Drive、Docs、Sheets、Slides、Chat、Classroom、Contacts、Tasks、People、Groups,以及仅限服务账号的 Keep。常见用法包括搜索与读取邮件、发送邮件与附件、管理标签,创建与响应日历事件及专注时间、外出、办公地点,Drive 文件列表、搜索、上传下载、共享,Sheets 读写与格式化,Docs/Slides 导出,Tasks、Contacts、Classroom 等操作。

使用方式:先安装并授权。安装命令为 brew install steipete/tap/gogcli;存储凭据用 gog auth credentials <path-to-credentials.json>;添加账号用 gog auth add user@gmail.com --services all。全局参数含 --account、--client、--json、--plain、--force、--no-input。示例:gog gmail search "is:unread";gog calendar events primary --from "2024-12-01" --to "2024-12-31";gog sheets read <spreadsheetId> "Sheet1!A1:D10"。可用管道配合 jq 处理 JSON,或用 --plain 配合 cut、xargs 做批处理。

配置:配置文件位于 macOS 的 ~/Library/Application Support/gogcli/config.json、Linux 的 ~/.config/gogcli/config.json、Windows 的 %AppData%\gogcli\config.json。环境变量包括 GOG_ACCOUNT、GOG_CLIENT、GOG_JSON、GOG_PLAIN、GOG_TIMEZONE、GOG_ENABLE_COMMANDS。

适用场景:适合在终端快速处理 Workspace 日常任务,或在脚本与自动化流程中批量操作,并可用 --no-input、--force 实现非交互执行。

限制:资料假定 gog 已安装并完成授权;若出现认证错误,不自动处理,需用户自行执行相应命令。Keep 仅支持服务账号。部分服务(如 Groups、Chat)仅限 Workspace。错误可对应处理:no credentials 用 gog auth credentials <file>;token expired 用 gog auth add <email> --force-consent;insufficient scope 用 gog auth add <email> --services <services>;command not found 用 brew install steipete/tap/gogcli。