Go client for gitignore.io
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd/gogi
.gitignore
.travis.yml
CHANGELOG.md
Dockerfile.build
Dockerfile.run
LICENSE
README.md
gogi.go
gogi_test.go
methods.go
methods_test.go

README.md

gogi - Go client for gitignore.io

Build Status Go Report Card GoDoc

Why gogi?

Make gitignore client more portable, without relying on the shell, curl, wget or any other http client.

Installation

go get -u github.com/Gnouc/gogi

Usage

As library

import (
	"fmt"
	"io/ioutil"
	"log"

	"github.com/Gnouc/gogi"
)

func main() {
	gogiClient, _ := gogi.NewHTTPClient()
	resp, _ := gogiClient.List()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
    if body != nil {
		defer resp.Body.Close()
	}

	fmt.Println(string(body))
}

As binary:

$ go get github.com/Gnouc/gogi/cmd/gogi
$ gogi
Usage of gogi:
  -create string
    	Create .gitignore content for given types
  -list
    	List all defined types
  -search string
    	Show all types match string

Using docker

Using gnouc/gogi image

$ docker pull gnouc/gogi
$ docker run --rm gnouc/gogi -search python
ipythonnotebook
python

Building your own image

Building builder image

docker build -t gogi-builder -f Dockerfile.build .

Building binary image

docker run --rm gogi-builder | docker build -t gogi -f Dockerfile.run -

Environment variables

GOGI_API_URL to change your gitignore server, default to https://www.gitignore.io

Author

Cuong Manh Le cuong.manhle.vn@gmail.com

License

See LICENSE