crdoc is a CLI tool to search and open documentation for Crystal language.
Please download a binary from release page (OS X only) or build
$ cd /your/favorite/directory/
$ git clone https://github.com/rhysd/crdoc.git && cd crdoc
$ git submodule update
$ crystal build --release bin/crdoc.cr
$ cp crdoc /your/favorite/bincrdoc search [-f] KEYWORD...
crdoc api [-f] KEYWORD...
crdoc syntax_and_semantics [-f] KEYWORD...
crdoc list [-p|--path] [-a|--api] [-s|--syntax-and-semantics]
crdoc update
searchsearches all documents with keyword(s) and show the result in browser.apisearches API document with keyword(s) and show the result in browser.syntax_and_semanticssearches 'syntax and semantics' document with keyword(s) and show the result in browser.listshows list of candidates. When--pathis specified, it shows full paths to HTML documents instead.updateupdates cached repository.
If you want to search documents incrementally, awesome filtering tools are available. You can use them as below (OS X example)
$ open "$(crdoc list --path | peco)"
$ open "$(crdoc list --path | percol)"If you often use these commands, it is also handy to make a function or an alias. Below is a Zsh & peco example.
function peco-crdoc() {
local open
case $OSTYPE in
darwin*)
open="open"
;;
linux*)
open="xdg-open"
;;
esac
local selected=$(crdoc list --path | peco --prompt 'crdoc >' --query "$LBUFFER")
if [ -n "$selected" ]; then
$open "${selected}"
fi
zle clear-screen
}
zle -N peco-crdoc- Show markdown document in CLI instead of opening with browser
- 'syntax and semantics' markdown documents already exists
- It is necessary to generate markdown document from inline documents in comment
- Add
--browseroption to preserve current features
- Ignore-case match
- Crystal v0.11.0
- Fork it ( https://github.com/rhysd/crdoc/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- @rhysd - creator, maintainer