cloc 统计项目代码量
最近需要对一个项目中的代码量进行统计,发现 cloc 可以完美的达到需求,简单命令行即可完成精确的统计。
GitHub 主页:https://github.com/AlDanial/cloc
常用语法
统计文件夹中的代码构成:
cloc /path/to/folder
统计当前文件夹:
cloc .
排除文件夹中某些文件夹:
cloc --exclude-dir=.github,myenv,build,dist .
效果如下:
cloc --exclude-dir=.git,.idea,.vscode,.github,myenv,build,dist .
33 text files.
26 unique files.
23 files ignored.
github.com/AlDanial/cloc v 2.04 T=0.16 s (162.0 files/s, 67602.7 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Python 22 1609 1947 6254
Markdown 2 114 0 484
JSON 1 0 0 403
Text 1 0 0 37
-------------------------------------------------------------------------------
SUM: 26 1723 1947 7178
-------------------------------------------------------------------------------
以上就是 cloc 的简单用法。