mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Fixes 4108; remove hidden files in kustomize edit command to correctly mimic shell globbing behaviour (#4170)
* util and util_test corrected * fixed behaviour of fsondisk with test updated * glob behaviour fixed in fsnode * removed commented code
This commit is contained in:
@@ -123,3 +123,21 @@ func InsertPathPart(path string, pos int, part string) string {
|
||||
result[pos] = part
|
||||
return PathJoin(append(result, parts[pos:]...))
|
||||
}
|
||||
|
||||
func IsHiddenFilePath(pattern string) bool {
|
||||
return strings.HasPrefix(filepath.Base(pattern), ".")
|
||||
}
|
||||
|
||||
// Removes paths containing hidden files/folders from a list of paths
|
||||
func RemoveHiddenFiles(paths []string) []string {
|
||||
if len(paths) == 0 {
|
||||
return paths
|
||||
}
|
||||
var result []string
|
||||
for _, path := range paths {
|
||||
if !IsHiddenFilePath(path) {
|
||||
result = append(result, path)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user