notion-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNotion CLI Skill
Notion CLI Skill
Use the binary from this repo to operate Notion. Prefer the local build when developing.
notion使用本仓库中的二进制文件来操作Notion。开发时优先选择本地构建版本。
notionInstall
安装
- Homebrew:
brew install inforix/tap/notion-cli - Release binary: download from GitHub releases and place on PATH
- Local build:
go build -o ./bin/notion ./src/cmd/notion
- Homebrew:
brew install inforix/tap/notion-cli - 发布版二进制文件:从GitHub Releases下载并添加到PATH中
- 本地构建:
go build -o ./bin/notion ./src/cmd/notion
Auth
身份验证
Set a Notion integration token in the environment:
export NOTION_TOKEN=YOUR_TOKENOptional: store the token with the CLI (if supported):
notion auth set --token YOUR_TOKEN在环境变量中设置Notion集成令牌:
export NOTION_TOKEN=YOUR_TOKEN可选:将令牌存储在CLI中(若支持):
notion auth set --token YOUR_TOKENCommands
命令
Auth
身份验证
notion auth set --token YOUR_TOKEN
notion auth status
notion auth clearnotion auth set --token YOUR_TOKEN
notion auth status
notion auth clearPages
页面
notion pages list --query "Project" --all
notion pages get <page_id>
notion pages create --body @page.json
notion pages update <page_id> --body @update.json
notion pages archive <page_id>
notion pages export <page_id> --assets=download -o page.mdnotion pages list --query "Project" --all
notion pages get <page_id>
notion pages create --body @page.json
notion pages update <page_id> --body @update.json
notion pages archive <page_id>
notion pages export <page_id> --assets=download -o page.mdDatabases
数据库
notion databases get <db_id>
notion databases query <db_id> --body @query.json
notion databases create --body @database.json
notion databases update <db_id> --body @update.jsonnotion databases get <db_id>
notion databases query <db_id> --body @query.json
notion databases create --body @database.json
notion databases update <db_id> --body @update.jsonBlocks
区块
notion blocks get <block_id>
notion blocks update <block_id> --body @block.json
notion blocks children append <block_id> --body @children.jsonnotion blocks get <block_id>
notion blocks update <block_id> --body @block.json
notion blocks children append <block_id> --body @children.jsonUsers
用户
notion users list --all
notion users get <user_id>notion users list --all
notion users get <user_id>Comments
评论
notion comments list --page-id <page_id>
notion comments list --block-id <block_id>
notion comments create --body @comment.jsonnotion comments list --page-id <page_id>
notion comments list --block-id <block_id>
notion comments create --body @comment.jsonSearch
搜索
notion search --body @query.jsonnotion search --body @query.jsonExamples
示例
notion --version
notion pages list --query "Project"
notion pages export <page_id>
notion pages get <page_id>
notion pages create --body @page.json
notion pages update <page_id> --body @update.json
notion pages archive <page_id>
notion databases query <db_id> --body @query.json
notion blocks children append <block_id> --body @children.json
notion users list --all
notion comments list --page-id <page_id>
notion search --body @query.jsonnotion --version
notion pages list --query "Project"
notion pages export <page_id>
notion pages get <page_id>
notion pages create --body @page.json
notion pages update <page_id> --body @update.json
notion pages archive <page_id>
notion databases query <db_id> --body @query.json
notion blocks children append <block_id> --body @children.json
notion users list --all
notion comments list --page-id <page_id>
notion search --body @query.jsonNotes
注意事项
- The CLI uses the Notion API and includes a header by default.
Notion-Version - Use to override when testing a specific API version.
--notion-version - Use ,
--page-size, and--cursorfor list pagination.--all - Use to render Go templates from JSON output.
--format - Use or
--versionto print the CLI version and exit.-V
- 该CLI使用Notion API,默认包含请求头。
Notion-Version - 测试特定API版本时,使用参数覆盖默认值。
--notion-version - 使用、
--page-size和--cursor参数处理列表分页。--all - 使用参数通过JSON输出渲染Go模板。
--format - 使用或
--version参数打印CLI版本并退出。-V