hhatto / gocloc

A little fast cloc(Count Lines Of Code)
MIT License
792 stars 79 forks source link

Exclude file names depending on path #93

Open cclarkedt opened 1 month ago

cclarkedt commented 1 month ago

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.