Contare le righe di un file sorgente con Cloc
Cloc è un programma gratuito e multi-piattaforma scritta in Perl che ci consente di contare il numero di righe di un file sorgente.
In più ci dice anche di che linguaggio parliamo, e ci conta anche le rgihe di commenti.
Inoltre, potete anche usarlo su file compressi.
Per installarlo su Arch Linux:
# pacman -Sy cloc
Oppure potete usare NPM:
# npm install -g cloc
Vediamo qualche esempio:
$ cloc main.cpp
1 text file.
1 unique file.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.02 s (55.5 files/s, 1164.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 1 3 0 18
-------------------------------------------------------------------------------
$ cloc browserconfig.xml
1 text file.
1 unique file.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.01 s (173.8 files/s, 1564.1 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
XML 1 0 0 9
-------------------------------------------------------------------------------
$ cloc Articoli.php
1 text file.
1 unique file.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.01 s (84.6 files/s, 58136.7 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
PHP 1 54 395 238
-------------------------------------------------------------------------------
$ cloc report.zip
25 text files.
25 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.02 s (1068.6 files/s, 67789.3 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
PHP 24 28 2 1540
HTML 1 0 5 11
-------------------------------------------------------------------------------
SUM: 25 28 7 1551
Enjoy!
software cloc npm perl
Commentami!