feat(scanner): add a new option for excluding paths based on a regexp
* Exclude paths based on new exclude pattern option * Add test for excluded paths * Add exclude pattern option to docs * Set exclude regexp only if given argument is set * Update scanner/scanner.go --------- Co-authored-by: Senan Kelly <senan@senan.xyz>
This commit is contained in:
@@ -62,6 +62,12 @@ func main() {
|
||||
confShowVersion := set.Bool("version", false, "show gonic version")
|
||||
_ = set.String("config-path", "", "path to config (optional)")
|
||||
|
||||
confExcludePatterns := set.String("exclude-pattern", "", "regex pattern to exclude files from scan (optional)")
|
||||
|
||||
if _, err := regexp.Compile(*confExcludePatterns); err != nil {
|
||||
log.Fatalf("invalid exclude pattern: %v\n", err)
|
||||
}
|
||||
|
||||
if err := ff.Parse(set, os.Args[1:],
|
||||
ff.WithConfigFileFlag("config-path"),
|
||||
ff.WithConfigFileParser(ff.PlainParser),
|
||||
@@ -125,6 +131,7 @@ func main() {
|
||||
server, err := server.New(server.Options{
|
||||
DB: dbc,
|
||||
MusicPaths: musicPaths,
|
||||
ExcludePattern: *confExcludePatterns,
|
||||
CacheAudioPath: cacheDirAudio,
|
||||
CoverCachePath: cacheDirCovers,
|
||||
PodcastPath: *confPodcastPath,
|
||||
|
||||
Reference in New Issue
Block a user