fsx

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFiles added in v1.9.30

func CollectFiles(paths []string, shouldIgnore func(path string) bool) ([]string, error)

CollectFiles recursively collects all files from given paths. Supports glob patterns (via doublestar), directories, and individual files. Skips paths that don't exist instead of returning an error. Optional shouldIgnore filter can exclude files/directories (return true to skip).

func CollectFilesFromTree added in v1.9.30

func CollectFilesFromTree(node *TreeNode, basePath string, files *[]string)

CollectFilesFromTree recursively collects file paths from a DirectoryTree. Pass basePath="" for relative paths, or a parent directory for absolute paths.

func ListDirectory

func ListDirectory(path string, shouldIgnore func(string) bool) ([]string, error)

func Matches added in v1.9.30

func Matches(path string, patterns []string) (bool, error)

Matches reports whether the given path matches any configured path or glob pattern. Useful for file watchers to determine if a changed file matches configured patterns.

Types

type TreeNode

type TreeNode struct {
	Name     string      `json:"name"`
	Type     string      `json:"type"`
	Children []*TreeNode `json:"children,omitempty"`
}

func DirectoryTree

func DirectoryTree(path string, isPathAllowed func(string) error, shouldIgnore func(string) bool, maxItems int) (*TreeNode, error)

type VCSMatcher added in v1.9.14

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

VCSMatcher handles VCS ignore pattern matching for a git repository

func NewVCSMatcher added in v1.9.14

func NewVCSMatcher(basePath string) (*VCSMatcher, error)

NewVCSMatcher creates a new VCS matcher for the given path. It searches for a git repository and loads .gitignore patterns. Returns (nil, nil) if no git repository is found - this is not an error. Results are cached by repository root path to avoid repeated parsing.

func (*VCSMatcher) RepoRoot added in v1.9.14

func (m *VCSMatcher) RepoRoot() string

RepoRoot returns the repository root path for this matcher

func (*VCSMatcher) ShouldIgnore added in v1.9.14

func (m *VCSMatcher) ShouldIgnore(path string) bool

ShouldIgnore checks if a path should be ignored based on VCS rules. It checks both .git directories and .gitignore patterns.

Jump to

Keyboard shortcuts

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