Documentation
¶
Overview ¶
Example (MatchesIncludeExclude) ¶
Example_matchesIncludeExclude demonstrates pattern matching
// Test various file patterns
files := []string{
"main.go",
"test.txt",
"debug.log",
".gitignore",
"temp.tmp",
}
include := []string{"*.go", "*.txt"}
exclude := []string{"*.log", "*.tmp"}
fmt.Println("File matching results:")
for _, file := range files {
result := matchesIncludeExclude(file, include, exclude)
fmt.Printf(" %s: %v\n", file, result)
}
Output: File matching results: main.go: true test.txt: true debug.log: false .gitignore: false temp.tmp: false
Example (ShouldIgnoreDirectory) ¶
Example_shouldIgnoreDirectory demonstrates directory filtering
directories := []string{
"/path/to/src",
"/path/to/.git",
"/path/to/node_modules",
"/path/to/build",
"/path/to/normal",
}
fmt.Println("Directory filtering results:")
for _, dir := range directories {
result := shouldIgnoreDirectory(dir)
fmt.Printf(" %s: ignored=%v\n", dir, result)
}
Output: Directory filtering results: /path/to/src: ignored=false /path/to/.git: ignored=true /path/to/node_modules: ignored=true /path/to/build: ignored=true /path/to/normal: ignored=false
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type WatchCallback ¶
type WatchCallback func(changedFiles []string)
WatchCallback is called when files change
type WatchOptions ¶
WatchOptions contains configuration for the file watcher
Example ¶
ExampleWatchOptions demonstrates how to create WatchOptions
// Create default options
defaultOptions := WatchOptions{
Dir: "",
Throttle: 1 * time.Second,
Include: []string{},
Exclude: []string{},
}
// Create custom options
customOptions := WatchOptions{
Dir: "/tmp",
Throttle: 500 * time.Millisecond,
Include: []string{"*.txt", "*.go"},
Exclude: []string{"*.log", "*.tmp"},
}
fmt.Printf("Default options: %+v\n", defaultOptions)
fmt.Printf("Custom options: %+v\n", customOptions)
Output: Default options: {Dir: Throttle:1s Include:[] Exclude:[]} Custom options: {Dir:/tmp Throttle:500ms Include:[*.txt *.go] Exclude:[*.log *.tmp]}
Click to show internal directories.
Click to hide internal directories.