Skip to content

mh-cbon/ignore-file

Repository files navigation

ignore-file

Parse and test an ignore file, such as .gitignore

Install

Pick an msi package here!

chocolatey

choco install ignore-file

deb/rpm repositories

wget -O - https://raw.githubusercontent.com/mh-cbon/latest/master/source.sh \
| GH=mh-cbon/ignore-file sh -xe
# or
curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/source.sh \
| GH=mh-cbon/ignore-file sh -xe

deb/rpm packages

curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/ignore-file sh -xe
# or
wget -q -O - --no-check-certificate \
https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/ignore-file sh -xe

go

mkdir -p $GOPATH/src/github.com/mh-cbon
cd $GOPATH/src/github.com/mh-cbon
git clone https://github.com/mh-cbon/ignore-file.git
cd ignore-file
glide install
go install

Usage as a lib

package main

import (
	"fmt"
	"github.com/mh-cbon/ignore-file/ignored"
)


func main() {

  ignore := ignored.Ignored{}
  if err := ignore.Load(".gitignore"); err != nil {
    fmt.Println(err)
    return nil
  }

  if err := ignore.Append(".git"); err != nil {
    fmt.Println(err)
    return nil
  }

  computed := ignore.ComputeDirectory(".")
  for _, l := range computed {
    fmt.Println(l)
  }
}

Usage as a binary

NAME:
   ignore-file - Test a ignore file

USAGE:
   ignore-file <ignore file path> <options>

VERSION:
   0.0.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --json, -j              return json response
   --also value, -a value  Add new rule
   --help, -h              show help
   --version, -v           print the version

EXAMPLE:
  ignore-file .gitignore
  ignore-file -a .git .gitignore
  ignore-file -a .git -a someother .gitignore

In other words,

$ ignore-file -a .git .gitignore
/.gitignore
/README.md
/fixtures/dira/fileb
/fixtures/dira/other
/fixtures/dira/some
/fixtures/dira/someother
/fixtures/dirb/fileb
/fixtures/dirb/other/fileb
/fixtures/dirb/other/some
/fixtures/filea
/fixtures/other
/fixtures/othera
/fixtures/otherfile
/fixtures/some
/fixtures/someother
/glide.lock
/glide.yaml
/ignored/index.go
/ignored/index_test.go
/main.go

About

Parse and test an ignore file, such as .gitignore

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages