Documentation
¶
Index ¶
- func FuzzyFilter(query string, items []string) []string
- func GlobWithDoublestar(pattern, searchPath string, limit int) ([]string, bool, error)
- func IsDirEntry(dir string, entry fs.DirEntry) bool
- func IsSafeWorkingDirectory(dir string) bool
- func SkipHidden(path string) bool
- func WalkFollowSymlinks(root string, fn fs.WalkDirFunc) error
- type FileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuzzyFilter ¶ added in v0.3.0
FuzzyFilter filters items by query using the same scoring algorithm as fzf. Results are sorted by match quality (best matches first).
func GlobWithDoublestar ¶
func IsDirEntry ¶ added in v0.624.6
IsDirEntry reports whether the entry is a directory, resolving symlinks so a link pointing at a directory is treated as one. dir is the directory holding the entry.
func IsSafeWorkingDirectory ¶ added in v0.412.3
IsSafeWorkingDirectory returns true when dir is safe to scan recursively. It returns false (unsafe) when dir is the filesystem root, the user's home directory, or any ancestor of the home directory, or when the directory contains no recognised project-marker file/folder.
The check is cross-platform: it uses os.SameFile for equality (handles symlinks and case-insensitive filesystems on Windows and macOS) and walks up from the home directory to detect ancestor paths correctly.
func SkipHidden ¶
func WalkFollowSymlinks ¶ added in v0.624.6
func WalkFollowSymlinks(root string, fn fs.WalkDirFunc) error
WalkFollowSymlinks walks the file tree rooted at root like filepath.WalkDir, but follows symbolic links that point to directories — both when the root itself is a link and for links found during the walk. Paths reported to fn are logical (they keep the link name, they are not rewritten to the target), which is what users and tools expect.
Symlink loops are avoided by tracking the resolved real path of every directory that has been entered; a link pointing at an already-visited directory is reported as an entry but not descended into.