Make exclude match on suffices by default
This commit is contained in:
parent
0276b1bfca
commit
5790d3ab5f
7
main.go
7
main.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/bmatcuk/doublestar/v4"
|
"github.com/bmatcuk/doublestar/v4"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -94,7 +95,11 @@ func run(c *cobra.Command, args []string) error {
|
||||||
searchPath = append(searchPath, ".")
|
searchPath = append(searchPath, ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, x := range excludeList {
|
for i, x := range excludeList {
|
||||||
|
if !strings.HasPrefix(x, "**/") && !strings.HasPrefix(x, "./") {
|
||||||
|
x = "**/" + x
|
||||||
|
excludeList[i] = x
|
||||||
|
}
|
||||||
if !doublestar.ValidatePattern(x) {
|
if !doublestar.ValidatePattern(x) {
|
||||||
return fmt.Errorf("invalid exclude pattern %q", x)
|
return fmt.Errorf("invalid exclude pattern %q", x)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue