file_ignore

package
v0.0.0-...-00062ea Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: 0BSD Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIgnoreFunc

func DefaultIgnoreFunc(worktree_root fs.FS, fpath string, d fs.DirEntry, err error) error

Skip ignored directories. Do nothing with ignored files.

func FnMatch

func FnMatch(name, pat string) (bool, error)

func FnMatchCase

func FnMatchCase(name, pat string) (bool, error)

func GetWorkTreeRoot

func GetWorkTreeRoot(start_dir string) (string, error)

func IsRoot

func IsRoot(fpath string) bool

func Parent

func Parent()

func ParentDirs

func ParentDirs(fpath string) []string

func ReverseInplace

func ReverseInplace[T any](slice []T) []T

ReverseInplace reverses a slice in place, then returns it.

func WalkWorktree

func WalkWorktree(worktree_fs fs.FS, start_dir string, fn, fn_ignore WalkDirFunc) error

Similar to `fs.WalkDir`, but calls a separate func for ignored files.

Types

type IgnoreCache

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

func NewIgnoreCache

func NewIgnoreCache(worktree_root fs.FS) *IgnoreCache

func (*IgnoreCache) MatchesIgnore

func (ic *IgnoreCache) MatchesIgnore(fpath string, de fs.DirEntry) bool

type IgnorePattern

type IgnorePattern struct {
	IgnoreRoot      string
	OriginalPattern string
	Pattern         string
	AsDir           bool
	Rooted          bool
	Negated         bool
}

func ParseIgnoreFile

func ParseIgnoreFile(worktree_root fs.FS, ignore_file_path string) ([]IgnorePattern, error)

For gitignore matching rules ee URL: https://git-scm.com/docs/gitignore

type WalkDirFunc

type WalkDirFunc func(worktree_root fs.FS, fpath string, d fs.DirEntry, err error) error

Jump to

Keyboard shortcuts

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