An open API service indexing awesome lists of open source software.

https://github.com/buraksezer/gdoc

Search GoDoc.org via command-line
https://github.com/buraksezer/gdoc

go godoc golang

Last synced: 6 months ago
JSON representation

Search GoDoc.org via command-line

Awesome Lists containing this project

README

          

# gdoc
[![Go Report Card](https://goreportcard.com/badge/github.com/buraksezer/gdoc)](https://goreportcard.com/report/github.com/buraksezer/gdoc)

gdoc is a small utility to search on GoDoc.org. It's also suitable to read package documents via command-line.

**Warning:** This tool is only tested on Linux and OSX.

### Install
With a properly configured Go environment:

```
go get -u github.com/buraksezer/gdoc
```

### Usage
#### Search something:

```
gdoc search
```
gdoc lists the first 10 package as default. If you want to increase or decrease that number, use `-c/--count` parameter:

```
gdoc search -c 3
```
gdoc has an interactive mode. If you use the `-i/--interactive` parameter when you search something, gdoc lists packages with numbers and await for your action to fetch its document from GoDoc.org.

Sample output:
```
gdoc search -i memberlist
==> (1) github.com/hashicorp/memberlist
==> imports: 192 stars: 804
memberlist is a library that manages cluster membership and member failure detection using a gossip based protocol.

==> (2) github.com/Nitro/memberlist
==> imports: 3 stars: 0
memberlist is a library that manages cluster membership and member failure detection using a gossip based protocol.

==> (3) github.com/journeymidnight/nentropy/memberlist
==> imports: 3 stars: 1
....
Give a number to read the document:
```
#### Read package documentation:

```
gdoc read
```

Sample usage:
```
gdoc read github.com/hashicorp/memberlist
```

Fetches the package document from GoDoc.org in text format and pipes to an available pager. gdoc looks for `GDOC_PAGER` and `PAGER` environment variables to get the pager command as respectively. If you want to disable paging, use `--disable-pager` parameter:
```
gdoc read --disable-pager
```

gdoc supports aliases to access easily the frequently used documents. If you set an alias for a package previously, just use `-a/--alias` to get the document for that package.

```
gdoc read -a
```

#### Aliases:
In order to add an alias for a package:
```
gdoc alias set
```

Sample usage:
```
gdoc alias set memberlist github.com/hashicorp/memberlist
```
If you want to delete previously setted alias, just use `del` subcommand:
```
gdoc alias del
```
You can use `list` subcommand to list already setted aliases.

### Contribution
gdoc is a free software, you feel free to send PRs to improve gdoc.

### License
gdoc is licensed under the GNU General Public License v3.0 - see LICENSE for more details.