Add iexclude option to backup command

This commit is contained in:
Johannes Hertenstein
2018-11-25 13:32:16 +01:00
committed by Alexander Neumann
parent 6dc7cca597
commit db82e6b80c
2 changed files with 30 additions and 14 deletions
+10
View File
@@ -88,6 +88,16 @@ func rejectByPattern(patterns []string) RejectByNameFunc {
}
}
// Same as `rejectByPattern` but case insensitive.
func rejectByInsensitivePattern(patterns []string) RejectByNameFunc {
for index, path := range patterns {
patterns[index] = strings.ToLower(path)
}
return func(item string) bool {
return rejectByPattern(patterns)(strings.ToLower(item))
}
}
// rejectIfPresent returns a RejectByNameFunc which itself returns whether a path
// should be excluded. The RejectByNameFunc considers a file to be excluded when
// it resides in a directory with an exclusion file, that is specified by