netsilik/代码行数计数器

独立实用脚本,用于计算代码行数。

dev-master 2019-09-02 11:39 UTC

This package is auto-updated.

Last update: 2024-08-29 04:31:22 UTC


README

简单实用脚本,用于计算代码行数。

欧洲联盟公共许可,版本 1.2

除非适用法律要求或书面同意,否则在许可下分发的软件按“原样”分发,不提供任何明示或暗示的保证或条件。

联系方式:info@netsilik.nl
最新版本可在以下链接获取:https://gitlab.com/Netsilik/LinesOfCodeCounter

安装

composer require netsilik/lines-of-code-counter

用法

代码行数计数器是一个命令行脚本

Usage: loc [OPTION]... DIRECTORY...
Count the lines of code in the files in the specified DIRECTORY(ies).

Mandatory arguments to long options are mandatory for short options too.
  -f, --file-mask              Process only files that match the file mask
      --help                   Display this help and exit
  -i, --ignore-dir=DIRECTORY   Ignore all files in the directory DIRECTORY
  -r, --recursive              Recursively process filse in sub-directories
      --version                Output version information and exit

计算当前目录及其所有子目录中所有 php 文件的代码行数

$ loc -rf *.php .

Parsed 11 (*.php) files out of a total of 29 files, in 12 directories and counted:
  1,051 total lines,
    157 empty lines,
    734 lines of code,
    108 comment lines,
    109 comments in total.

计算 src 目录中所有 php 文件的代码行数

$ loc -f *.php src

Parsed 1 (*.php) file out of a total of 1 file, in 1 directory and counted:
  331 total lines,
   53 empty lines,
  247 lines of code,
   18 comment lines,
   18 comments in total.

计算当前目录及其所有子目录中所有 phphtml 文件的代码行数,排除 vendor 目录

$ loc -rf *.php,*.html -i vendor .

Parsed 7 (*.php, *.html) files out of a total of 16 files, in 6 directories and counted:
  1,466 total lines,
    108 empty lines,
  1,322 lines of code,
     23 comment lines,
     33 comments in total.