PRF: #10644 调整空白

This commit is contained in:
pityonline 2018-10-13 22:50:43 +08:00
parent 1538343b60
commit 09dcd65e41
No known key found for this signature in database
GPG Key ID: 89C97C8DF02C633E

View File

@ -9,15 +9,13 @@ Cloc 计算不同编程语言源代码的行数
Cloc 有很多优势: Cloc 有很多优势:
* 容易安装和实用,不需要额外的依赖项。 * 容易安装和实用,不需要额外的依赖项。
* 便携式 * 便携式
* 支持多种的结果格式导出包括纯文本、SQL、JSON、XML、YAML、CSV * 支持多种的结果格式导出包括纯文本、SQL、JSON、XML、YAML、CSV
* 可以计算 git 的提交数 * 可以计算 git 的提交数
* 可递归计算文件夹内的代码行数 * 可递归计算文件夹内的代码行数
* 可计算压缩后的文件tar、zip、Java ear * 可计算压缩后的文件tar、zip、Java ear
* 开源跨平台部署 * 开源跨平台部署
### 安装 ### 安装
@ -27,42 +25,36 @@ Arch Linux:
``` ```
$ sudo pacman -S cloc $ sudo pacman -S cloc
``` ```
Debian, Ubuntu: Debian, Ubuntu:
``` ```
$ sudo apt-get install cloc $ sudo apt-get install cloc
``` ```
CentOS, Red Hat, Scientific Linux: CentOS, Red Hat, Scientific Linux:
``` ```
$ sudo yum install cloc $ sudo yum install cloc
``` ```
Fedora: Fedora:
``` ```
$ sudo dnf install cloc $ sudo dnf install cloc
``` ```
FreeBSD: FreeBSD:
``` ```
$ sudo pkg install cloc $ sudo pkg install cloc
``` ```
当然你也可以使用第三方的包管理器比如[**NPM**][2]。 当然你也可以使用第三方的包管理器比如[**NPM**][2]。
``` ```
$ npm install -g cloc $ npm install -g cloc
``` ```
### 使用实例 ### 使用实例
@ -78,14 +70,12 @@ int main()
printf("Hello, World!"); printf("Hello, World!");
return 0; return 0;
} }
``` ```
想要计算行数,只需要简单运行: 想要计算行数,只需要简单运行:
``` ```
$ cloc hello.c $ cloc hello.c
``` ```
输出: 输出:
@ -106,7 +96,6 @@ $ cloc hello.c
``` ```
$ cloc file.tar.gz $ cloc file.tar.gz
``` ```
输出: 输出:
@ -117,12 +106,10 @@ $ cloc file.tar.gz
除了源代码文件Cloc 还能递归的计算各个目录及其子目录下的文件、压缩包、甚至 git 中的 commit 数目等。 除了源代码文件Cloc 还能递归的计算各个目录及其子目录下的文件、压缩包、甚至 git 中的 commit 数目等。
**文件夹中使用的例子:** **文件夹中使用的例子:**
``` ```
$ cloc dir/ $ cloc dir/
``` ```
![][4] ![][4]
@ -131,7 +118,6 @@ $ cloc dir/
``` ```
$ cloc dir/cloc/tests $ cloc dir/cloc/tests
``` ```
![][5] ![][5]
@ -140,7 +126,6 @@ $ cloc dir/cloc/tests
``` ```
$ cloc archive.zip $ cloc archive.zip
``` ```
![][6] ![][6]
@ -153,7 +138,6 @@ $ git clone https://github.com/AlDanial/cloc.git
$ cd cloc $ cd cloc
$ cloc 157d706 $ cloc 157d706
``` ```
![][7] ![][7]
@ -162,20 +146,16 @@ $ cloc 157d706
``` ```
$ cloc --show-lang $ cloc --show-lang
``` ```
当然help 能告诉你更多关于 Cloc 的使用帮助。 当然help 能告诉你更多关于 Cloc 的使用帮助。
``` ```
$ cloc --help $ cloc --help
``` ```
开始使用吧! 开始使用吧!
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
via: https://www.ostechnix.com/cloc-count-the-lines-of-source-code-in-many-programming-languages/ via: https://www.ostechnix.com/cloc-count-the-lines-of-source-code-in-many-programming-languages/