Documentation
¶
Index ¶
- func GetDefaultRules() []config.Rule
- func LoadPackRules(packPath string) ([]config.Rule, error)
- func LoadPackRulesFS(packPath string, fs types.FS) ([]config.Rule, error)
- func LoadRules(k *koanf.Koanf) ([]config.Rule, error)
- func MergeRules(global, packSpecific []config.Rule) []config.Rule
- type FileInfo
- type Match
- type Matcher
- type ProcessorHandler
- type RuleMatch
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultRules ¶
GetDefaultRules returns the default set of rules Order matters: exclusions, exact matches, globs, directories, catchall
func LoadPackRules ¶
LoadPackRules loads pack-specific rules from a pack's .dodot.toml
func LoadPackRulesFS ¶
LoadPackRulesFS loads pack-specific rules from a pack's .dodot.toml using the provided filesystem
Types ¶
type FileInfo ¶
type FileInfo struct {
Path string // Relative path within pack
Name string // Base name
IsDirectory bool // Whether this is a directory
}
FileInfo represents a file or directory to be processed
type Match ¶
type Match struct {
PackName string // Name of the pack
FilePath string // Relative path within pack
FileName string // Base name of the file
IsDirectory bool // Whether this is a directory
Handler string // Handler to process this file
Options map[string]interface{} // Handler options from rule
}
Match represents a file matched by a rule
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher handles the matching of files against rules for packs
func (*Matcher) GetMatches ¶
GetMatches scans packs and returns all rule matches using the rule system
func (*Matcher) GetMatchesFS ¶
GetMatchesFS scans packs and returns all rule matches using the rule system with a custom filesystem This function is used for testing and commands that need to use a different filesystem
type ProcessorHandler ¶
type ProcessorHandler interface {
// ProcessFiles modifies the file list before normal matching
ProcessFiles(files []FileInfo, packPath string) ([]FileInfo, error)
}
ProcessorHandler runs before normal handlers to modify file list
type RuleMatch ¶
type RuleMatch struct {
// RuleName is the pattern that matched this file
RuleName string
// Pack is the name of the pack containing the matched file
Pack string
// Path is the relative path within the pack
Path string
// AbsolutePath is the absolute path to the file
AbsolutePath string
// Metadata contains any additional data about the matched file
Metadata map[string]interface{}
// HandlerName is the name of the handler that should process this match
HandlerName string
// HandlerOptions contains options to pass to the handler
HandlerOptions map[string]interface{}
// Priority determines the order of processing (higher = processed first)
Priority int
}
RuleMatch represents a successful rule match on a file or directory This is the output from the rules system that gets passed to handlers
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner scans packs and applies rules to find matches
func NewScanner ¶
NewScanner creates a new scanner with the given rules
func NewScannerWithFS ¶
NewScannerWithFS creates a new scanner with the given rules and filesystem