Skip to content

shihanng/gig

Repository files navigation

gig -- .gitignore generator

GitHub GitHub release (latest by date) Go Report Card Coverage Status

gig is a command line tool to help you create useful .gitignore files for your project. It is inspired by gitignore.io and make use of the large collection of useful .gitignore templates of the web service. This also means that gig supports the are four file types that gitignore.io recognizes. Content generated by gig should match the one generated by gitignore.io except the order of stacks in which gitignore.io does not seem to guarantee any.

Motivation

Prior to this project, I used to have one of these command lines in my .zshrc. However, problems I have with this command line are that

Therefore this tool is created to solve the two main problems above.

Install

brew install shihanng/gig/gig

Binaries

The release page contains binaries built for various platforms. Download then extract the binary with tar -xf. Place the binary in the $PATH e.g. /usr/local/bin.

With go get

go get github.com/shihanng/gig

Usage

There are several ways you can generate the .gitignore file:

Using the supported language as input arguments

$ gig gen Go Elm

### Elm ###
# elm-package generated files
elm-stuff
# elm-repl generated files
repl-temp-*

### Go ###
# Binaries for programs and plugins
...

At the very first run the program will clone the templates repository https://github.com/toptal/gitignore.git into $XDG_CACHE_HOME/gig. This means that internet connection is not required after the first successful run.

Using the search functionality (depends on fzf)

$ gig search

gig search demo

Using the EXPERIMENTAL auto generate functionality

$ gig autogen

For more information, see

gig --help

Development

Found a bug or want to hack around? Clone the repository:

git clone git@github.com:shihanng/gig.git

When you are ready run the tests:

make test
make integ-test
make lint

Where test run the tests that can be run locally. integ-test run the tests that require internet access. lint help you write better Go codes.

Add subcommand with cobra (version managed in tools.go with go.mod):

$ cobra --config .cobra.yaml add <new subcommand>

Update golden file:

$ go test . -tags=integration -update