finder

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSFinderOptions added in v1.4.0

type FSFinderOptions func(*FileSystemFinder)

func WithExcludeDirs added in v1.4.0

func WithExcludeDirs(excludeDirs []string) FSFinderOptions

Add a custom list of file types to the FSFinder

func WithExcludeFileTypes added in v1.4.0

func WithExcludeFileTypes(types []string) FSFinderOptions

WithExcludeFileTypes adds excluded file types to FSFinder.

func WithFileTypes added in v1.4.0

func WithFileTypes(fileTypes []filetype.FileType) FSFinderOptions

Add a custom list of file types to the FSFinder

func WithPathRoot added in v1.4.0

func WithPathRoot(path string) FSFinderOptions

Set the CLI SearchPath

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 {
	PathRoot         string
	FileTypes        []filetype.FileType
	ExcludeDirs      []string
	ExcludeFileTypes []string
}

func FileSystemFinderInit added in v1.4.0

func FileSystemFinderInit(opts ...FSFinderOptions) *FileSystemFinder

func (FileSystemFinder) Find

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

Find implements the FileFinder interface by recursively walking through all subdirectories (excluding the excluded subdirectories) and identifying if the file matches a type defined in the fileTypes array.

Jump to

Keyboard shortcuts

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