rules

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultExcludes

func DefaultExcludes() []types.Rule

func NewBinaryRule added in v0.2.3

func NewBinaryRule() types.Rule

func NewExtensionRule

func NewExtensionRule(exts []string, action types.RuleAction) types.Rule

func NewPatternRule

func NewPatternRule(patterns []string, action types.RuleAction) types.Rule

Types

type BaseRule

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

BaseRule provides common functionality

func (*BaseRule) Action

func (r *BaseRule) Action() RuleAction

type BinaryRule added in v0.2.3

type BinaryRule struct {
	types.BaseRule
}

func (*BinaryRule) Match added in v0.2.3

func (r *BinaryRule) Match(path string) bool

Match checks if a file is binary using three methods: 1. Known binary file extensions 2. Presence of null bytes in the first 1024 bytes 3. UTF-8 validation of the content

type ExtensionRule

type ExtensionRule struct {
	types.BaseRule
	// contains filtered or unexported fields
}

func (*ExtensionRule) Match

func (r *ExtensionRule) Match(path string) bool

type PatternRule

type PatternRule struct {
	types.BaseRule
	// contains filtered or unexported fields
}

func (*PatternRule) Match

func (r *PatternRule) Match(path string) bool

func (*PatternRule) Patterns

func (r *PatternRule) Patterns() []string

type Rule

type Rule interface {
	Match(path string) bool
	Action() RuleAction
}

type RuleAction

type RuleAction int
const (
	Include RuleAction = iota
	Exclude
	Skip
)

Jump to

Keyboard shortcuts

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