Skip to content

CLI 命令行工具 ​

概述 ​

open-note-cli 提供命令行接口,支持通过终端操作笔记。

安装 ​

  • 方式一:在桌面端软件的 设置 → CLI工具 点击 安装CLI
  • 方式二:
bash
pip install open-note-cli

验证安装 ​

bash
opennote --version

使用方法 ​

bash
opennote --help

配置 ​

建议使用默认数据库路径,无需额外配置。

修改数据库路径 ​

如需指定数据库路径,可配置数据库路径:

bash
open-note config set-db /path/to/notes.db

或设置环境变量:

bash
export OPEN_NOTE_DB_PATH=/path/to/notes.db

查看配置 ​

如需查看当前配置:

bash
opennote config get

命令参考 ​

note ​

笔记管理命令组。

list ​

列出笔记。

bash
opennote note list

选项:

选项短选项默认值说明
--limit-l10显示数量上限
--category-c无按分类过滤
--favorites-fFalse只显示收藏

示例:

bash
# 显示前 20 条
opennote note list -l 20

# 只看"工作"分类
opennote note list -c 工作

# 只看收藏
opennote note list -f

show ​

查看笔记详情。

bash
opennote note show <note_id>

示例:

bash
opennote note show abc12345

create ​

创建笔记。

bash
opennote note create --title <标题> [--content <内容>] [--category <分类>] [--tags <标签>]

选项:

选项短选项默认值说明
--title-t必填笔记标题
--content-c无笔记内容(不传时打开编辑器)
--category—无分类名称
--tags—无标签(逗号分隔)

示例:

bash
# 快速创建
opennote note create -t "会议记录" -c "讨论内容..." --category 工作 --tags "重要,待办"

# 打开编辑器
opennote note create -t "会议记录"

edit ​

编辑笔记。

bash
opennote note edit <note_id> [--title <新标题>] [--content <新内容>]

选项:

选项短选项说明
--title-t新标题
--content-c新内容(不传时打开编辑器,预填现有内容)

示例:

bash
# 修改标题
opennote note edit abc12345 -t "新标题"

# 打开编辑器修改
opennote note edit abc12345

delete ​

删除笔记。

bash
opennote note delete <note_id>

示例:

bash
opennote note delete abc12345

搜索笔记。

bash
opennote note search <关键词> [--limit <数量>] [--category <分类>]

选项:

选项短选项默认值说明
--limit-l10结果数量上限
--category-c无按分类过滤

示例:

bash
# 搜索
opennote note search "React"

# 在"工作"分类中搜索
opennote note search "会议" -c 工作

mcp ​

MCP 服务管理命令组。

start ​

启动 MCP 服务器。

bash
opennote mcp start

说明:

  • 自动检查 open-note-mcp 是否已安装
  • 未安装时会询问是否自动安装
  • 启动后保持运行,按 Ctrl+C 停止

inspect ​

查看 MCP 配置信息(静态输出)。

bash
opennote mcp inspect

输出内容:

  • 可用的 MCP 工具列表
  • 数据库路径

config ​

配置管理命令组。

get ​

查看当前配置。

bash
opennote config get

输出内容:

  • 数据库路径(db_path)

自动更新检查 ​

每次执行命令时,CLI 会自动检查是否有新版本可用,并在终端提示。

故障排查 ​

Q: 找不到数据库 ​

确保使用默认数据库路径:

bash
opennote config get

Q: MCP 启动失败 ​

确保已安装 open-note-mcp:

bash
pip install open-note-mcp

Q: 命令执行慢 ​

首次执行时会检查更新,后续会有缓存。