Documentation
¶
Index ¶
- func DirTrim(pwd string, lim int) string
- func Expand(s string) (string, error)
- func GlobWithDoubleStar(pattern, searchPath string, limit int) ([]string, bool, error)
- func HasPrefix(path, prefix string) bool
- func ListDirectory(initialPath string, ignorePatterns []string, depth, limit int) ([]string, bool, error)
- func Lookup(dir string, targets ...string) ([]string, error)
- func LookupClosest(dir, target string) (string, bool)
- func NewDirectoryLister(rootPath string) *directoryLister
- func Owner(path string) (int, error)
- func PathOrPrefix(path, prefix string) string
- func PrettyPath(path string) string
- func ShouldExcludeFile(rootPath, filePath string) bool
- func SkipHidden(path string) bool
- func ToUnixLineEndings(content string) (string, bool)
- func ToWindowsLineEndings(content string) (string, bool)
- type FastGlobWalker
- type FileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand is a wrapper around expand.Literal. It will escape the input string, expand any shell symbols (such as '~') and resolve any environment variables.
func GlobWithDoubleStar ¶
func HasPrefix ¶
HasPrefix checks if the given path starts with the specified prefix. Uses filepath.Rel to determine if path is within prefix.
func ListDirectory ¶
func ListDirectory(initialPath string, ignorePatterns []string, depth, limit int) ([]string, bool, error)
ListDirectory lists files and directories in the specified path,
func Lookup ¶
Lookup searches for a target files or directories starting from dir and walking up the directory tree until filesystem root is reached. It also checks the ownership of files to ensure that the search does not cross ownership boundaries. It skips ownership mismatches without errors. Returns full paths to fount targets. The search includes the starting directory itself.
func LookupClosest ¶
LookupClosest searches for a target file or directory starting from dir and walking up the directory tree until found or root or home is reached. It also checks the ownership of files to ensure that the search does not cross ownership boundaries. Returns the full path to the target if found, empty string and false otherwise. The search includes the starting directory itself.
func NewDirectoryLister ¶
func NewDirectoryLister(rootPath string) *directoryLister
func Owner ¶
Owner retrieves the user ID of the owner of the file or directory at the specified path.
func PathOrPrefix ¶
PathOrPrefix returns the prefix if the path starts with it, or falls back to the path otherwise.
func PrettyPath ¶
func ShouldExcludeFile ¶
ShouldExcludeFile checks if a file should be excluded from processing based on common patterns and ignore rules
func SkipHidden ¶
func ToUnixLineEndings ¶
ToUnixLineEndings converts Windows line endings (CRLF) to Unix line endings (LF).
func ToWindowsLineEndings ¶
ToWindowsLineEndings converts Unix line endings (LF) to Windows line endings (CRLF).
Types ¶
type FastGlobWalker ¶
type FastGlobWalker struct {
// contains filtered or unexported fields
}
FastGlobWalker provides gitignore-aware file walking with fastwalk It uses hierarchical ignore checking like git does, checking .gitignore/.crushignore files in each directory from the root to the target path.
func NewFastGlobWalker ¶
func NewFastGlobWalker(searchPath string) *FastGlobWalker
func (*FastGlobWalker) ShouldSkip ¶
func (w *FastGlobWalker) ShouldSkip(path string) bool
ShouldSkip checks if a path should be skipped based on hierarchical gitignore, crushignore, and hidden file rules