For details please see The Reason I Created agentDoc and Why You Don't Need it In short, I found fzf and fasd powerful. There's no need to make another wheel unless for study purpose.
But if you still think agentDoc
better in some ways, enjoy!
agentDoc - An agent which makes documents easy to be accessed, modified and searched.
agentDoc [.=]
agentDoc [PATTERN]
agentDoc [+-] [DOCNAME]
agentDoc [SOURCE | DOCNAME] [DESTINATION | DOCNAME]
agentDoc
review the most unread doc
agentDoc .
list all docs
agentDoc + docname
create a doc to edit
agentDoc - docname
delete a doc
agentDoc pattern
search a doc to edit
agentDoc URL/filepath1/docname1 filepath2/docname2
append a page/file/doc to an internal doc or an external file
agentDoc URL/filepath1/docname1 dirpath
export a page/file/doc to a directory
agentDoc = [comment]
sync with git
agentDoc -h
help
agentDoc guesses the filename if not provided.
When the managed folder is synced with Github Wiki, the default filename is 'home'.
When the managed folder is a git repository, the default filename is 'readme'.
When agentDoc
is called without any arguments, it searches through the managed directory for the most unread document and open it.
With this feature you may recurrently review your documents and
- remember everything in your knowledge base
- keep your notes neat and useful
The score to evaluate how 'unread' a document is = ((now - last_access_time) / (1 + last_access_time - last_change_time) - 1) * doc_size
If all the scores are less than 0, another score0 = (now - last_access_time) / (1 + last_access_time - last_change_time) is used.
When searching, agentDoc
looks at the filenames and contents to pick the only file with its name or content exactly or partially matching the pattern, then opens it for editing.
In every search phase if the result contains multiple files, agentDoc
prints them and quit immediately.
curl "https://raw.githubusercontent.com/cf020031308/agentDoc/master/agentDoc" -o /usr/local/bin/agentDoc
chmod 755 /usr/local/bin/agentDoc
Put or link agentDoc as a copy into the folder where you hope to manage documents. Then name the copy as the extension of the managed documents, such as md
or txt
. It can also be hidden by being named as .md
, .txt
, etc.
And It's recommended to link the copy into $path
such as /usr/local/bin/agentDoc
to make it convenient to use.
ln -sf agentDoc /Documents/cheatsheet/.md
ln -sf /Document/cheatsheet/md /usr/local/bin/cheat
Manage cheatsheet in markdown format with command cheat
cp agentDoc /Documents/myproject.wiki.git/md
ln -sf /Document/myproject.wiki.git/md /usr/local/bin/wk
Manage documents of github wiki in markdown format with command wk
ln -sf agentDoc ~/.vim/snippets/snippets
ln -sf ~/.vim/snippets/snippets /usr/local/bin/snippets
Manage vim-snippets with command snippets
With different extensions and aliases agentDoc becomes:
- Shortcut
- Todo app
- Cheatsheet
- Snippet manager
- Wiki, blog, diary, ...
- ...
agentDoc
leverages the power of Github https://github.com and markdown https://guides.github.com/features/mastering-markdown/.
- Properly fix referenced URLs when getting a remote markdown file
- Automatically manage images referenced in a local markdown file
- When editing, you can reference an image relative to your working directory (PWD);
- When appending, images referenced in the source file will be copied to the destination folder, and links converted as well.
- When syncing, images in the managed folder which are not referenced will be removed before pushing.
- Friendly with Github
- URLs of raw. When getting a remote file from Github or Github Wiki,
agentDoc
guesses the URL of the raw file according to the given URL. - Issue links. When getting a remote file from Github, GFM Issue links will be converted to normal links.
- URLs of raw. When getting a remote file from Github or Github Wiki,
The agentDoc
utility exits 0 on success, and >0 if an error occurs.
git(1), curl(1)
Written first in May, 2018 by Roy https://github.com/cf020031308/agentDoc
Distributed under the terms of the BSD license.