Windows下统计代码行数cloc

1.介绍

cloc(Count Lines of Code)是一个流行的开源工具,用于统计给定文件或文件夹中的代码行数。它支持多种编程语言,包括C、C++、C/C++头文件(.h或.hpp)以及Python(.py)。

2.安装

https://github.com/AlDanial/cloc
下载可执行程序,并将路径添加到系统环境变量中。
或者点击下载:cloc

3.使用

下是一个简化的命令示例,它将统计当前目录及其子目录中C、C++、C++头文件和Python文件的行数,并只显示汇总信息:

cloc --include-lang=C,C++,C_Header,Python .

执行结果:

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              650          54200          50984         254012
Python                         678          41977          71300         199438
C++                             38           1587            299           3491
-------------------------------------------------------------------------------
SUM:                          1366          97764         122583         456941
-------------------------------------------------------------------------------

Related Posts