Momentique/CodeLines-VsCode

GitHub: Momentique/CodeLines-VsCode

一款面向 C 系语言的命令行工具,用于统计代码行数并可导出移除注释和空行后的净代码文件。

Stars: 0 | Forks: 0

# CodeLines [![构建状态](https://ci.appveyor.com/api/projects/status/oach5ro1fk86xa23?svg=true)](https://ci.appveyor.com/project/waiting/codelines) 一个用于统计代码行数的工具,也可用于移除代码中的注释和空行。支持所有 C 系列编程语言。 ## 命令详细 ``` CodeLines [--m] [--l] [--r] [--s] [--v] [--j] [--help] ext1 [ext2] [ext3] ... <-|+> search_path ... [-o output_path[{name}.{ext}]] --m: Count the number of lines containing comments --l: Count the number of blank lines --r: Use regular expressions --s: Silent mode --v: Display detailed warnings per code line --j: Output JSON-formatted results --help: 显示帮助 ext1 ext2 ext3 ...: When --r is specified, this can be a regular expression matching filenames. (To match file extensions, append $, e.g., ext$) -: Indicates recursive search of the specified path list +: Indicates search of the specified path list without subdirectories search_path ...: Search path -o: Output to the output_path directory based on the current directory. When using /, output the processed source code files to the output_path directory. When using :, output the processed source code files to the output_path directory while preserving the original directory structure. The source code file naming rules are specified by the subsequent string. Available variables are {name} and {ext}, representing the filename and extension respectively. ``` ## 关于 + - 目录模式的说明 当模式为 - 时,会展开子目录。因此,search_path 不得包含嵌套模式,否则文件会被重复统计。 例如: ``` C:\aaa\bbb C:\aaa\bbb\ccc ``` 第一个路径已经包含了第二个路径,因此无需指定后者,以避免重复。 当模式为 `+` 时,不展开子文件夹。因此,上述路径不会被重复统计。 ## 例子 1. 统计当前目录下 cpp、c 和 h 文件的行数: CodeLines cpp c h - . 2. 统计 C:\Project 下 cpp、c 和 h 文件的行数: CodeLines cpp c h - C:\Project 3. 统计 C:\Project、D:\Project 和 E:\Project 下 cpp、c 和 h 文件的行数: CodeLines cpp c h - C:\Project D:\Project E:\Project 4. 使用正则表达式匹配源代码文件: CodeLines --r cpp$ main\.c .+\.h - C:\Project D:\Project 5. 将处理后的代码文件输出到当前目录: CodeLines cpp hpp c h - C:\Project -o . 或 CodeLines cpp hpp c h - C:\Project -o ./ 或 CodeLines cpp hpp c h - C:\Project -o ./{name}.{ext} 重命名 CodeLines cpp hpp c h - C:\Project -o ./{name}_tmp.{ext} 6. 按照源代码目录结构,将处理后的代码文件输出到当前目录内: CodeLines cpp hpp c h - C:\Project -o .: 或 CodeLines cpp hpp c h - C:\Project -o .:{name}.{ext} 重命名 CodeLines cpp hpp c h - C:\Project -o .:{name}_tmp.{ext}
标签:API安全, C/C++, C-Family, CLI, C Sharp, DNS 反向解析, IP 地址批量处理, JSON输出, SOC Prime, UML, WiFi技术, 事务性I/O, 云安全监控, 代码审计辅助, 代码清理, 代码统计, 代码行数统计, 代码规范, 开发工具, 批量处理, 文本处理, 注释移除, 源代码处理, 空白行清理, 静态分析