pattern

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TypeContent = "content"
View Source
const TypeGlob = "glob"
View Source
const TypeRegex = "re"
View Source
const TypeShebang = "shebang"

Variables

This section is empty.

Functions

func FirstLine

func FirstLine(path string) (line string, err error)

Types

type Content

type Content struct {
	// contains filtered or unexported fields
}

func NewContent

func NewContent(str string) (*Content, error)

func (*Content) Match

func (c *Content) Match(
	_ context.Context,
	f *file.File,
) (match bool, err error)

type Glob

type Glob struct {
	// contains filtered or unexported fields
}

func NewGlob

func NewGlob(str string) (*Glob, error)

func (*Glob) Match

func (g *Glob) Match(_ context.Context, f *file.File) (ok bool, err error)

type Matcher

type Matcher interface {
	Match(context.Context, *file.File) (bool, error)
}

type Pattern

type Pattern struct {
	Type, String string
	// contains filtered or unexported fields
}

func NewPattern added in v0.0.2

func NewPattern(typ, str string) (p *Pattern, err error)

func (*Pattern) Compare added in v0.0.2

func (p *Pattern) Compare(other *Pattern) (i int)

func (*Pattern) Equals

func (p *Pattern) Equals(other *Pattern) bool

func (*Pattern) MarshalYAML

func (p *Pattern) MarshalYAML() (interface{}, error)

func (*Pattern) Match

func (p *Pattern) Match(ctx context.Context, f *file.File) (bool, error)

func (*Pattern) UnmarshalYAML

func (p *Pattern) UnmarshalYAML(value *yaml.Node) error

type Regex

type Regex struct {
	// contains filtered or unexported fields
}

func NewRegex

func NewRegex(str string) (*Regex, error)

func (*Regex) Match

func (r *Regex) Match(_ context.Context, f *file.File) (bool, error)

type Set

type Set struct {
	util.SortedSet[*Pattern]
}

func (*Set) MarshalYAML added in v0.0.2

func (s *Set) MarshalYAML() (interface{}, error)

func (*Set) Match

func (s *Set) Match(
	ctx context.Context,
	f *file.File,
) (ok bool, firstMatch *Pattern, err error)

func (*Set) Merge added in v0.0.2

func (s *Set) Merge(src reflect.Value) (err error)

func (*Set) UnmarshalYAML added in v0.0.2

func (s *Set) UnmarshalYAML(value *yaml.Node) (err error)

type Shebang

type Shebang struct {
	// contains filtered or unexported fields
}

func NewShebang

func NewShebang(str string) (*Shebang, error)

func (*Shebang) Match

func (s *Shebang) Match(_ context.Context, f *file.File) (bool, error)

Jump to

Keyboard shortcuts

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