finder

package
v3.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSFinderOptions

type FSFinderOptions func(*FileSystemFinder)

func WithDepth

func WithDepth(depthVal int) FSFinderOptions

WithDepth adds the depth for search recursion to FSFinder

func WithExcludeDirs

func WithExcludeDirs(excludeDirs []string) FSFinderOptions

Add a custom list of file types to the FSFinder

func WithExcludeFileTypes

func WithExcludeFileTypes(types []string) FSFinderOptions

WithExcludeFileTypes adds excluded file types to FSFinder.

func WithFileTypes

func WithFileTypes(fileTypes []filetype.FileType) FSFinderOptions

Add a custom list of file types to the FSFinder

func WithGitignore

func WithGitignore(enabled bool) FSFinderOptions

WithGitignore enables skipping files/directories matched by .gitignore patterns

func WithIgnoreFiles

func WithIgnoreFiles(paths []string) FSFinderOptions

WithIgnoreFiles skips files/directories matched by gitignore-style pattern files.

func WithPathRoots

func WithPathRoots(paths ...string) FSFinderOptions

Set the CLI SearchPath

func WithTypeOverrides

func WithTypeOverrides(overrides []TypeOverride) FSFinderOptions

WithTypeOverrides adds glob pattern to file type mappings

type FileFinder

type FileFinder interface {
	Find() ([]FileMetadata, error)
}

Find will return an array of FileMetadata objects from a provided path and array of FileTypes. Any files in subdirectories defined in excludeDirs will not be returned

type FileMetadata

type FileMetadata struct {
	Name     string
	Path     string
	FileType filetype.FileType
}

The File Metadata object stores the name and the path of the file and the type of file that it is, example: json, yml, etc

type FileSystemFinder

type FileSystemFinder struct {
	PathRoots        []string
	FileTypes        []filetype.FileType
	ExcludeDirs      map[string]struct{}
	ExcludeFileTypes map[string]struct{}

	Depth         *int
	TypeOverrides []TypeOverride
	Gitignore     bool
	IgnoreFiles   []string
	// contains filtered or unexported fields
}

func FileSystemFinderInit

func FileSystemFinderInit(opts ...FSFinderOptions) *FileSystemFinder

func (FileSystemFinder) Find

func (fsf FileSystemFinder) Find() ([]FileMetadata, error)

Find implements the FileFinder interface by calling findOne on all the PathRoots and providing the aggregated FileMetadata after ignoring all the duplicate files

func (FileSystemFinder) MatchFile

func (fsf FileSystemFinder) MatchFile(path string) ([]FileMetadata, error)

MatchFile applies the finder filters to a single file path and returns it as a FileMetadata slice if it passes all filters, or an empty slice if it is excluded. Used by watch mode to check a single changed file without a full directory walk.

type TypeOverride

type TypeOverride struct {
	Pattern  string
	FileType filetype.FileType
}

Jump to

Keyboard shortcuts

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