Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhysd/crdoc
CLI tool to search and open documentation for Crystal language
https://github.com/rhysd/crdoc
Last synced: 3 months ago
JSON representation
CLI tool to search and open documentation for Crystal language
- Host: GitHub
- URL: https://github.com/rhysd/crdoc
- Owner: rhysd
- License: mit
- Created: 2015-10-02T20:39:02.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-23T19:36:35.000Z (almost 9 years ago)
- Last Synced: 2024-10-05T12:33:05.520Z (4 months ago)
- Language: Crystal
- Size: 21.5 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
crdoc
=======
[![Build Status](https://travis-ci.org/rhysd/crdoc.svg)](https://travis-ci.org/rhysd/crdoc)`crdoc` is a CLI tool to search and open documentation for [Crystal language](https://github.com/manastech/crystal).
## Installation
Please download a binary from [release page](https://github.com/rhysd/crdoc/releases) (OS X only) or build
```sh
$ 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/bin
```## Usage
```
crdoc 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
```![main usage](https://raw.githubusercontent.com/rhysd/ss/master/crdoc/crdoc.gif)
- `search` searches all documents with keyword(s) and show the result in browser.
- `api` searches API document with keyword(s) and show the result in browser.
- `syntax_and_semantics` searches 'syntax and semantics' document with keyword(s) and show the result in browser.
- `list` shows list of candidates. When `--path` is specified, it shows full paths to HTML documents instead.
- `update` updates cached repository.## Using with [peco](https://github.com/peco/peco)/[percol](https://github.com/mooz/percol)
If you want to search documents incrementally, awesome filtering tools are available.
You can use them as below (OS X example)```sh
$ open "$(crdoc list --path | peco)"
$ open "$(crdoc list --path | percol)"
```![peco example](https://raw.githubusercontent.com/rhysd/ss/master/crdoc/peco-crdoc.gif)
If you often use these commands, it is also handy to make a function or an alias. Below is a Zsh & peco example.
```zsh
function peco-crdoc() {
local open
case $OSTYPE in
darwin*)
open="open"
;;
linux*)
open="xdg-open"
;;
esaclocal selected=$(crdoc list --path | peco --prompt 'crdoc >' --query "$LBUFFER")
if [ -n "$selected" ]; then
$open "${selected}"
fi
zle clear-screen
}
zle -N peco-crdoc
```## TODOs
- 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 `--browser` option to preserve current features
- Ignore-case match## Development
- Crystal v0.11.0
## Contributing
1. Fork it ( https://github.com/rhysd/crdoc/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request## Contributors
- [@rhysd](https://github.com/rhysd) - creator, maintainer