Skip to content

add two new flags for glob support#16

Open
ksdpmx wants to merge 1 commit intocontainerd:masterfrom
ksdpmx:glob
Open

add two new flags for glob support#16
ksdpmx wants to merge 1 commit intocontainerd:masterfrom
ksdpmx:glob

Conversation

@ksdpmx
Copy link

@ksdpmx ksdpmx commented Apr 17, 2024

There're some hardcoded directories and files excluded implicitly.
And sometimes we may need some kind of flexibility for specifing exclusions,

  1. ignoring some files inside of one folder
  2. ignoring multiple folders with naming convention.

So here introducing two new opt-in flags:

  • -exclude-dirs
  • -exclude-files

The default behavior for these two flags aligns with the existing -excludes for backward compatiblity.
And glob matching is supported, e.g. ./ltag -check -v -path ./test -exclude-dirs ".git .svn vendor image/module[abc]" -exclude-files "LICENSE MAINTAINERS OWNERS test/temp.go test/internal/foo*.go".
-excludes can be deleted if breaking change is acceptable.

Signed-off-by: jasonz <ksdpmx@gmail.com>
}

excludeList := strings.Split(*excludes, " ")
excludeDirs := strings.Split(*excludedirs, " ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if a file path contains a space?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func main() {
ppath := flag.String("path", ".", "project path")
excludes := flag.String("excludes", "vendor", "exclude folders")
excludedirs := flag.String("exclude-dirs", ".git .svn vendor", "exclude dirs matching with glob patterns")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the flag name it is not clear how this differs from excludes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants