cgag / loc

Count lines of code quickly.
MIT License
2.31k stars 126 forks source link

Feature request: file "include" regex #10

Closed alekratz closed 7 years ago

alekratz commented 7 years ago

--exclude feature is nice to have when counting large projects. However, it would be awesome if there was an --include regex flag as well.

cgag commented 7 years ago

I really wanted this yesterday when trying to debug counting for python. Totally think this should be a thing. Will do this soon, thanks.

cgag commented 7 years ago

Added here: https://github.com/cgag/loc/commit/6f0ffd644f8ac08fae399161a990940f984a4382

Plus some nice cleanup of the filter logic. Surprisingly it's just as fast as this code here, which avoids doing a match on the regex for every file: https://github.com/cgag/loc/commit/c08ef5a6d69cb84b0979dd166103d865ed9647eb. Thanks branch predictors.