gocloc icon indicating copy to clipboard operation
gocloc copied to clipboard

Exclude file names depending on path

Open cclarkedt opened this issue 1 year ago • 3 comments

The --not-match option only considers the base name.

Current behaviour: Let's say I have the file structure:

.
├── app.py
└── test_dir
    └── app.py

And I want to exclude test_dir/app.py but not the root app.py, ideally I would use the supported regex format allowed by the --not-match option like below:

$ gocloc --not-match="(test_dir/app.py)" .     

However, this won't ignore the test file as I would like. This behaviour works the other way around too as if I wanted to ignore app.py but not test_dir/app.py, I might do:

$ gocloc --not-match="(app.py)" . 

But this will now ignore both of the files regardless of their location.

Desired behaviour: For the file matching to account for the full path the file is being compared to.

cclarkedt avatar Aug 06 '24 16:08 cclarkedt

@hhatto What are your thoughts?

cclarkedt avatar Oct 30 '24 10:10 cclarkedt

@cclarkedt

Sorry for late reply.

I do not want to change the behavior of an option that already exists if possible. So I decided to add the --fullpath option as another suggestion in #100 .

This can be accomplished by doing the following:

$ gocloc --fullpath --not-match="test_dir/app.py"

What do you think about this changes?

hhatto avatar Dec 26 '24 01:12 hhatto

Thanks for looking at this, is much appreciated. I just added one comment for review on the PR

cclarkedt avatar Jan 02 '25 10:01 cclarkedt