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 | -l | 10 | 显示数量上限 |
--category | -c | 无 | 按分类过滤 |
--favorites | -f | False | 只显示收藏 |
示例:
bash
# 显示前 20 条
opennote note list -l 20
# 只看"工作"分类
opennote note list -c 工作
# 只看收藏
opennote note list -fshow
查看笔记详情。
bash
opennote note show <note_id>示例:
bash
opennote note show abc12345create
创建笔记。
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 abc12345delete
删除笔记。
bash
opennote note delete <note_id>示例:
bash
opennote note delete abc12345search
搜索笔记。
bash
opennote note search <关键词> [--limit <数量>] [--category <分类>]选项:
| 选项 | 短选项 | 默认值 | 说明 |
|---|---|---|---|
--limit | -l | 10 | 结果数量上限 |
--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 getQ: MCP 启动失败
确保已安装 open-note-mcp:
bash
pip install open-note-mcpQ: 命令执行慢
首次执行时会检查更新,后续会有缓存。