Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultExtensions is a predefined slice of strings containing common file // extensions (such as ".go" and ".ts") used as default values when searching // for files using the Options struct. DefaultExtensions = []string{ ".go", ".ts", } // DefaultExclude is a predefined slice of strings containing common file // exclusion patterns, such as hidden directories, build directories, and test // directories. It is used as a default value when searching for files using the // Options struct. DefaultExclude = []string{ "**/.*/**", "**/dist/**", "**/node_modules/**", "**/vendor/**", "**/testdata/**", "**/test/**", "**/tests/**", "**/*.pb.go", } // Default is a predefined instance of the Options struct with commonly used // file extensions and exclusion patterns. It serves as a starting point for // file searching configurations. Default = Options{ Extensions: DefaultExtensions, Exclude: DefaultExclude, } )
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
Option is a functional option type that allows customization of the behavior of the Options struct, which is used in the file search process. It can be used to modify extensions, include or exclude specific patterns, and other search-related configurations.
func Exclude ¶
Exclude appends the given patterns to the Options.Exclude field, marking them to be excluded from the file search. The function returns an Option for use with the Files function.
func Extensions ¶ added in v0.0.4
Extensions returns an Option that sets the allowed file extensions for the Options struct. The given exts parameter is a list of strings representing the desired file extensions.
type Options ¶ added in v0.0.4
Options is a configuration struct that defines the filtering rules for file searching, such as file extensions to include, patterns to include or exclude. It provides methods for determining if a given file path is included or excluded based on these rules.