filesystem

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileItem

type FileItem struct {
	Path  string
	IsDir bool
	Level int
}

FileItem represents a file or directory found when walking the filesystem.

func WalkDirectory

func WalkDirectory(root string, gitIgnore *GitIgnoreManager, filter *FilterManager, useGitIgnore, showHidden bool) ([]FileItem, error)

WalkDirectory traverses the root directory taking into account gitignore and hidden files.

type FilterManager

type FilterManager struct {
	Patterns []string
}

func NewFilterManager

func NewFilterManager() *FilterManager

func (*FilterManager) AddGlobPattern

func (f *FilterManager) AddGlobPattern(pattern string)

func (*FilterManager) ShouldInclude

func (f *FilterManager) ShouldInclude(path string) bool

type GitIgnoreManager

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

GitIgnoreManager manages gitignore patterns for a repository.

func NewGitIgnoreManager

func NewGitIgnoreManager(root string) (*GitIgnoreManager, error)

NewGitIgnoreManager reads the .gitignore file (if present) and returns a manager.

func (*GitIgnoreManager) IsIgnored

func (g *GitIgnoreManager) IsIgnored(path string) bool

IsIgnored returns true if the provided path is ignored.

Jump to

Keyboard shortcuts

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