Qnote 可以让您快速创建和搜索数以万计的短信。
#
笔记存储在 SQLite 数据库中(即将支持更多数据库)。搜索由 Bleve(默认)或 Elasticsearch 提供,并进行一些额外的设置。
如果您还没有这样做,则需要设置 Golang。比你刚跑
go get github.com/anmil/quicknote/cmd/qnote
这将拉取该库并将其构建到您的 Golang bin 目录中。
书籍允许您将相关笔记彼此分开,例如工作笔记与个人笔记。除非另有说明,每个操作仅在工作簿上执行。您可以使用-n
标志更改工作簿。
创建一本新书
qnote new book <book name>
qnote ls books
您可以删除书籍以及书中的所有笔记。
qnote rm book <book name>
如果您想删除一本书但保留笔记。您可以将这本书合并到另一本书中。合并书籍将一本书中的所有笔记移动到另一本书,然后删除空书。
qnote merge <book to delete> <book to move notes to>
书籍可以通过两种方式进行分割,可以是查询结果,也可以是笔记 ID 列表。
通过查询
qnote split query <book name> <query>
这将在工作簿上执行查询搜索(使用 QueryStringQuery),查询结果将被移动到<book name>
(如果不存在则创建它)。您不需要在查询字符串中指定书籍。它已经为您添加了。
通过 ID
qnote split ids <book name> <note ids...>
其作用相同,但不是查询注释,而是移动给定 id 的注释。
打开编辑器(默认 Vim,使用 Env: EDITOR 覆盖)并创建新注释
qnote new note
注释通过解析器运行,解析器将第一行作为标题,其余的作为正文。任何以#
字符开头的单词都用作注释的标签。
使用以下文本创建注释
This is a test #note
notes are #cool and #fun
one #note is never enough
将创建一个标题为This is a test #note
、标签为note, cool, fun
和正文的注释
notes are #cool and #fun
one #note is never enough
您还可以从 URL 创建注释。
qnote new url <url>
qnote 将对 URL 执行 GET 请求。它将解析返回的 HTML 中的网页title
、 meta[name=keywords]
和meta[name=description]
标签。标题加上 URL 作为标题,关键字作为标签,描述作为正文。它将打开填写此信息的编辑器,并允许您在保存之前进行更改。
列出书中的所有笔记
qnote ls notes
列出所有书中的所有笔记
qnote ls notes all
打开编辑器并编辑注释
qnote edit note <note id>
删除注释
qnote rm note `<note id>`
qnote 默认使用 Bleve,但也支持 ElasticSearch,用于索引笔记并允许搜索。如果您不介意进行一些额外的设置,则建议使用 ElasticSearch,因为它更强大且更快。如果安装 Elasticsearch,则可以编辑 qnote 的配置文件,该文件位于 Linux 上的$HOME/.config/quicknote
和 Max OSX 上的$HOME/Library/Application Support/quicknote
中。
使用短语前缀在工作簿中搜索笔记
qnote search query
您还可以通过设置-q
标志来使用更强大的查询语法 QueryStringQuery (Bleve ElasticSearch)。请注意,使用-q
标志时,查询将在所有书籍上运行。
您可以搜索的字段包括id
、 created
、 modifed
、 title
、 tags
(公共分隔列表)、 body
和book
。因此,如果您想在“工作”一书中搜索带有“projectx”标签的任何笔记。你会跑
对于布莱夫
qnote search -q "+book:Work +tag:projectx"
和弹性搜索
qnote search -q "book:Work AND tags:projectx"
当您创建、编辑和删除笔记时,qnote 将负责更新索引。但是,如果您由于某些原因需要重新索引,例如更改索引提供程序、重新安装 ElasticSearch、从另一个系统复制注释数据库。你可以运行
qnote search reindex
qnote 将重新索引所有笔记。
备份笔记的最简单方法是复制数据目录$HOME/.config/quicknote
Linux 上)和$HOME/Library/Application Support/quicknote
(Max OSX 上)中的 qnote.db。您还可以使用qnote ls notes
命令中的-f
标志以 csv 或 json 格式导出列表。
目前,无法从 csv 或 json 恢复笔记。
所有命令和标志都是help
命令中的文档。简单运行qnote help <command>
查看任何命令的描述和标志
示例1:
$ qnote help
Qnote allows you to quickly create and search tens of thousands of short notes.
Create Books to organize collections of notes.
Add tags to notes for more accurate searching.
Export your notes in text, csv, and json.
Notes are stored in an SQLite database (support for more databases is coming).
Searching is provided by Bleve by default, or Elasticsearch with some extra setup.
Usage:
qnote [command]
Available Commands:
delete Delete Note or Notebook
edit Edit Note or Notebook
get Get/List Notes, Notebook, Tags
merge Merge all notes from <book_name 1> into <book_name 2>
new Create new Note or Notebook
search Search notes
split Split Book
version Print the version of qnote
Flags:
-n, --notebook string Working Notebook (default "General")
Use "qnote [command] --help" for more information about a command.
示例2:
$ qnote help edit book
Edit the working Book's name. This requires re-index the Book
Usage:
qnote edit book <new book_name> [flags]
Global Flags:
示例3:
$ qnote get -h
Get/List Notes, Notebook, Tags
Usage:
qnote get [command]
Aliases:
get, list, ls
Available Commands:
book List all books
note List all notes in the working Book, or all notes for the given [note id...]
tag lists all tags for the working Book
Flags:
-f, --display-format string Format to display notes in [ids, text, short, json, csv] (default "text")
-d, --display-order string The order to display Notebook, Notes, Tags [asc, desc] (default "asc")
-s, --sort-by string Sort notes by [id, created, modified, title] (default "modified")
Global Flags:
-n, --notebook string Working Notebook (default "General")
Use "qnote get [command] --help" for more information about a command.