matcher

package
v0.0.0-...-21f80b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchGit

func MatchGit(path string) bool

MatchGit returns true if the path is a .git folder or is inside a .git folder.

Types

type MatchType

type MatchType int
const (
	GitIgnore MatchType = iota
	GlobIgnore
	Match
)

type Matcher

type Matcher interface {
	Match(path string) MatchType
}

Matcher provides a method that returns the match type.

  • Match: file should be scanned
  • GitIgnore: ignored due to .gitignore
  • GlobIgnore: ignored due to glob pattern

func NewMatcher

func NewMatcher(path string, glob string) Matcher

NewMatcher returns a Matcher. If a git repository is found on the provided path or on a parent directory, all .gitignore files are respected. The provided glob provides an additional filter.

If a glob pattern is not needed, pass '*'.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL