cloc

Cloc check files that include text


Cloc has a way to exclude files that contain text using --exclude-content=<regex>. I’m looking for a way to do the opposite. How can I check files that only include certain phrases? I've tried cloc . --exclude-content='/^((?!import).)*$/s' but it doesn't give the desired results. I have also tried writing an ignored file using --ignored but that only gives the ignored reason, and not the line count.

How would I be able go about only including files that contain text?


Solution

  • This was added to cloc.

    cloc-master/./cloc ../Folder --include-content="import Nimble" --by-file-by-lang --quiet > QuickAndNimbleFiles.txt