pathfilter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pathfilter provides glob-based file filtering using doublestar patterns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

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

Filter holds the include and exclude patterns for file filtering

func DefaultFilter

func DefaultFilter() *Filter

DefaultFilter returns a filter with default patterns

func New

func New(include, exclude []string) *Filter

New creates a new Filter with the given include and exclude patterns

func (*Filter) FilterFiles

func (f *Filter) FilterFiles(dir string) ([]string, error)

FilterFiles returns a list of files in dir that match the include patterns and do not match any exclude patterns. The returned paths are relative to dir.

func (*Filter) FilterFilesAbs

func (f *Filter) FilterFilesAbs(dir string) ([]string, error)

FilterFilesAbs returns absolute paths of filtered files

func (*Filter) MatchFile

func (f *Filter) MatchFile(path string) (bool, error)

MatchFile checks if a single file path matches the filter criteria

func (*Filter) WalkDir

func (f *Filter) WalkDir(dir string, fn func(path string, d fs.DirEntry) error) error

WalkDir walks the directory applying the filter and calling fn for each matching file

Jump to

Keyboard shortcuts

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