Cloc检查包含文本的文件。

huangapple go评论96阅读模式
英文:

Cloc check files that include text

问题

Cloc 有一种方法可以使用 --exclude-content=<regex> 来排除包含特定文本的文件。我正在寻找一种方法来执行相反的操作。如何检查仅包含特定短语的文件?我尝试过 cloc . --exclude-content='/^((?!import).)*$/s' 但它没有提供所需的结果。我还尝试过使用 --ignored 来编写一个被忽略的文件,但那只提供了被忽略的原因,而不是行数。

我应该如何只包括包含文本的文件?

英文:

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?

答案1

得分: 0

这已经添加到 cloc。

英文:

This was added to cloc.

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

huangapple
  • 本文由 发表于 2023年4月17日 20:35:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76035212.html
  • cloc
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定