Exclude dotfiles by default, add --include-dotfiles flag
Changed the default behavior to exclude dotfiles (files/dirs starting with .) which is the more common use case. Added --include-dotfiles flag for when hidden files need to be included in the manifest.
This commit is contained in:
@@ -41,8 +41,8 @@ func (m *manifest) String() string {
|
||||
|
||||
// ManifestScanOptions configures behavior when scanning directories for manifest generation.
|
||||
type ManifestScanOptions struct {
|
||||
IgnoreDotfiles bool // Skip files and directories starting with a dot
|
||||
FollowSymLinks bool // Resolve symlinks instead of skipping them
|
||||
IncludeDotfiles bool // Include files and directories starting with a dot (default: exclude)
|
||||
FollowSymLinks bool // Resolve symlinks instead of skipping them
|
||||
}
|
||||
|
||||
func (m *manifest) HasError() bool {
|
||||
@@ -153,7 +153,7 @@ func pathIsHidden(p string) bool {
|
||||
}
|
||||
|
||||
func (m *manifest) addFile(p string, fi fs.FileInfo, sfsIndex int) error {
|
||||
if m.scanOptions.IgnoreDotfiles && pathIsHidden(p) {
|
||||
if !m.scanOptions.IncludeDotfiles && pathIsHidden(p) {
|
||||
return nil
|
||||
}
|
||||
if fi != nil && fi.IsDir() {
|
||||
|
||||
Reference in New Issue
Block a user