Add a -i flag to force showing 'index.html' in the output listing; by default do not show them.

This commit is contained in:
Pim van Pelt
2025-12-03 12:23:40 +01:00
parent 7829000c55
commit 16fa899b91
4 changed files with 42 additions and 29 deletions

View File

@@ -158,15 +158,16 @@ var ExtensionTypes = map[string]string{
}
type Options struct {
TopDir string
Filter string
OutputFile string
DirAppend bool
Recursive bool
IncludeHidden bool
ExcludeRegex *regexp.Regexp
Verbose bool
DryRun bool
TopDir string
Filter string
OutputFile string
DirAppend bool
Recursive bool
IncludeHidden bool
ExcludeRegex *regexp.Regexp
Verbose bool
DryRun bool
ShowIndexFiles bool
}
type FileEntry struct {
@@ -275,7 +276,7 @@ func ReadDirEntries(dirPath string, opts *Options) ([]FileEntry, error) {
for _, file := range files {
fileName := file.Name()
if strings.EqualFold(fileName, opts.OutputFile) {
if !opts.ShowIndexFiles && strings.EqualFold(fileName, opts.OutputFile) {
continue
}