|
cloc is a tool for counting lines of source code information against blank, commented and physical lines of source code in many programming languages. Given two versions of a code base, cloc can count the difference between blank lines, comment lines, and source lines. It is written entirely in Perl and does not depend on the standard distribution of Perl v5.6 and higher (code from some external modules is embedded in cloc), so it is very portable. As you know, cloc runs on a wide variety of Linux, FreeBSD, NetBSD, OpenBSD, macOS, AIX, HP-UX, Solaris, IRIX, z/OS, and Windows. (To run the Perl source version of cloc on Windows, you need ActiveState Perl 5.6.1 or later, Strawberry Perl, a Windows subsystem for Linux, Cygwin, the MobaXTerm installer Perl plug-in, or a mingw environment and terminal such as the one provided by provided by Git for Windows. Alternatively, you can use the Windows binaries of the cloc generated by PAR::Packer to run on a Windows computer that has neither Perl nor Cygwin).
GitHub address: https: //github.com/AlDanial/cloc Download: https: //github.com/AlDanial/cloc/releases/latest
Installation via Package Manager
npm install -g cloc # https://www.npmjs.com/package/cloc sudo apt install cloc # Debian, Ubuntu sudo yum install cloc # Red Hat, Fedora sudo dnf install cloc # Fedora 22 or later sudo pacman -S cloc # Arch sudo emerge -av dev-util/cloc # Gentoo https://packages.gentoo.org/packages/dev-util/cloc sudo apk add cloc # Alpine Linux doas pkg_add cloc # OpenBSD sudo pkg install cloc # FreeBSD sudo port install cloc # macOS with MacPorts brew install cloc # macOS with Homebrew choco install cloc # Windows with Chocolatey scoop install cloc # Windows with Scoop You can add cloc to your environment variables, see the tutorial below:
cmd set permanent environment variable command h ttps:// www.itsvse.com/thread-9230-1-1.html Count the amount of code in the current folder
Excluding the amount of code in a folder
Counting lines of code for individual files in a directory
Parameter Options
--diff <set1> <set2> - Counts the code differences between the source files of set1 and set2. The input can be a mix of files and directories. --git - Forces inputs to be recognized as git targets if they are not first recognized as file or directory names. --ignore-whitespace - Ignore horizontal whitespace when comparing files with --diff. ---max-file-size=<MB> - Skip files larger than a given amount of MB if they are to be skipped. --exclude-dir=<dir1>,<dir2> - Exclude the given comma-separated directories. --exclude-ext=<ext1>,<ext2> - To exclude the given file extensions. --csv - Export results to CSV file format. --csv-delimiter=<C> - Use the character <C> as a delimiter. --out=<file> - Save results to <file> . --quiet - Disables all informational messages and displays only the final report. --sql=<file> - Writes the results as create and insert statements, which can be read by database programs such as SQLite.
(end) |
Previous: PDF.JS preview pdf file, the Chinese does not show the problemNext: OData] (a) OData's basic knowledge
|