Compare commits

...

3 Commits

Author SHA1 Message Date
Seednode 974a4c79fc Fix inverted functionality of --case-sensitive flag, but actually apply the change when filtering 2023-09-25 17:13:31 -05:00
Seednode 271714f1de Fix inverted functionality of --case-sensitive flag 2023-09-25 17:08:40 -05:00
Seednode 55953c649b Updated readme 2023-09-25 17:06:41 -05:00
4 changed files with 14 additions and 5 deletions

View File

@ -117,6 +117,7 @@ Flags:
-b, --bind string address to bind to (default "0.0.0.0")
-c, --cache generate directory cache at startup
--cache-file string path to optional persistent cache file
--case-sensitive use case-sensitive matching for filters
--code enable support for source code files
--code-theme string theme for source code syntax highlighting (default "solarized-dark256")
--exit-on-error shut down webserver on error, instead of just printing the error

View File

@ -42,7 +42,11 @@ func (filters *filters) apply(fileList []string) []string {
if filters.hasExcludes() {
for _, exclude := range filters.excluded {
result = slices.DeleteFunc(fileList, func(s string) bool {
return strings.Contains(strings.ToLower(s), strings.ToLower(exclude))
if CaseSensitive {
return strings.Contains(s, exclude)
} else {
return strings.Contains(strings.ToLower(s), strings.ToLower(exclude))
}
})
}
}
@ -50,7 +54,11 @@ func (filters *filters) apply(fileList []string) []string {
if filters.hasIncludes() {
for _, include := range filters.included {
result = slices.DeleteFunc(fileList, func(s string) bool {
return !strings.Contains(strings.ToLower(s), strings.ToLower(include))
if CaseSensitive {
return !strings.Contains(s, include)
} else {
return !strings.Contains(strings.ToLower(s), strings.ToLower(include))
}
})
}
}

View File

@ -11,7 +11,7 @@ import (
)
const (
ReleaseVersion string = "0.92.0"
ReleaseVersion string = "0.92.2"
)
var (

View File

@ -49,9 +49,9 @@ func splitQueryParams(query string, regexes *regexes) []string {
for i := 0; i < len(params); i++ {
switch {
case regexes.alphanumeric.MatchString(params[i]) && CaseSensitive:
results = append(results, strings.ToLower(params[i]))
case regexes.alphanumeric.MatchString(params[i]):
results = append(results, params[i])
case regexes.alphanumeric.MatchString(params[i]):
results = append(results, strings.ToLower(params[i]))
}
}