gccli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Calendar CLI

Google Calendar CLI

Command-line interface for Google Calendar operations.
用于Google Calendar操作的命令行界面。

Installation

安装

bash
npm install -g @mariozechner/gccli
bash
npm install -g @mariozechner/gccli

Setup

设置

Google Cloud Console (one-time)

Google Cloud Console(一次性操作)

  1. Create a new project (or select existing)
  2. Enable the Google Calendar API
  3. Set app name in OAuth branding
  4. Add test users (all Gmail addresses you want to use)
  5. Create OAuth client:
    • Click "Create Client"
    • Application type: "Desktop app"
    • Download the JSON file
  1. 创建新项目(或选择现有项目)
  2. 启用Google Calendar API
  3. 在OAuth品牌设置中设置应用名称
  4. 添加测试用户(所有你想使用的Gmail地址)
  5. 创建OAuth客户端
    • 点击“创建客户端”
    • 应用类型:“桌面应用”
    • 下载JSON文件

Configure gccli

配置gccli

First check if already configured:
bash
gccli accounts list
If no accounts, guide the user through setup:
  1. Ask if they have a Google Cloud project with Calendar API enabled
  2. If not, walk them through the Google Cloud Console steps above
  3. Have them download the OAuth credentials JSON
  4. Run:
    gccli accounts credentials ~/path/to/credentials.json
  5. Run:
    gccli accounts add <email>
    (use
    --manual
    for browserless OAuth)
首先检查是否已配置:
bash
gccli accounts list
如果没有账户,引导用户完成设置:
  1. 询问用户是否有已启用Calendar API的Google Cloud项目
  2. 如果没有,引导用户完成上述Google Cloud Console步骤
  3. 让用户下载OAuth凭证JSON文件
  4. 运行:
    gccli accounts credentials ~/path/to/credentials.json
  5. 运行:
    gccli accounts add <email>
    (使用
    --manual
    参数进行无浏览器OAuth验证)

Usage

使用方法

Run
gccli --help
for full command reference.
Common operations:
  • gccli <email> calendars
    - List all calendars
  • gccli <email> events <calendarId> [--from <dt>] [--to <dt>]
    - List events
  • gccli <email> event <calendarId> <eventId>
    - Get event details
  • gccli <email> create <calendarId> --summary <s> --start <dt> --end <dt>
    - Create event
  • gccli <email> freebusy <calendarIds> --from <dt> --to <dt>
    - Check availability
Use
primary
as calendarId for the main calendar.
运行
gccli --help
获取完整命令参考。
常见操作:
  • gccli <email> calendars
    - 列出所有日历
  • gccli <email> events <calendarId> [--from <dt>] [--to <dt>]
    - 列出日程
  • gccli <email> event <calendarId> <eventId>
    - 获取日程详情
  • gccli <email> create <calendarId> --summary <s> --start <dt> --end <dt>
    - 创建日程
  • gccli <email> freebusy <calendarIds> --from <dt> --to <dt>
    - 查询空闲时间
使用
primary
作为calendarId指代主日历。

Date/Time Format

日期/时间格式

  • Timed events:
    YYYY-MM-DDTHH:MM:SSZ
    (UTC) or
    YYYY-MM-DDTHH:MM:SS
    (local)
  • All-day events:
    YYYY-MM-DD
    with
    --all-day
    flag
  • 定时日程:
    YYYY-MM-DDTHH:MM:SSZ
    (UTC时间)或
    YYYY-MM-DDTHH:MM:SS
    (本地时间)
  • 全天日程:
    YYYY-MM-DD
    加上
    --all-day
    参数

Data Storage

数据存储

  • ~/.gccli/credentials.json
    - OAuth client credentials
  • ~/.gccli/accounts.json
    - Account tokens
  • ~/.gccli/credentials.json
    - OAuth客户端凭证
  • ~/.gccli/accounts.json
    - 账户令牌