Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cloc(1) [debian man page]

cloc(1) 							       Devel								   cloc(1)

NAME
cloc - statistics utility to count lines of code SYNOPSIS
cloc [options] <FILE|DIR> ... DESCRIPTION
Count physical lines of source code in the given files (may be archives such as compressed tarballs or zip files) and/or recursively below the given directories. Counts blank lines, comment lines, and physical lines of source code in many programming languages. It is written entirely in Perl, using only modules from the standard distribution. OPTIONS
Input Options --extract-with=CMD This option is only needed if cloc is unable to figure out how to extract the contents of the input file(s) by itself. Use <cmd> to extract binary archive files (e.g.: .tar.gz, .zip, .Z). Use the literal '>FILE<' as a stand-in for the actual file(s) to be extracted. For example, to count lines of code in the input files gcc-4.2.tar.gz perl-5.8.8.tar.gz on Unix use: --extract-with='gzip -dc >FILE< | tar xf - or, if you have GNU tar: --extract-with='tar zxf >FILE' and on Windows, use: --extract-with=""c:Program FilesWinZipWinZip32.exe" -e -o >FILE< --list-file=FILE Take the list of file and/or directory names to process from FILE which has one file/directory name per line. See also --exclude-list-file --unicode Check binary files to see if they contain Unicode expanded ASCII text. This causes performance to drop noticably. Processing Options B>--by-file> Report results for every source file encountered. --by-file-by-lang Report results for every source file encountered in addition to reporting by language. --force-lang=LANG[,EXT] Process all files that have a EXT extension with the counter for language LANG. For example, to count all .f files with the Fortran 90 counter (which expects files to end with .f90) instead of the default Fortran 77 counter, use: --force-lang="Fortran 90",f If EXT is omitted, every file will be counted with the LANG counter. This option can be specified multiple times (but that is only useful when EXT is given each time). See also --script-lang. --read-binary-files Process binary files in addition to text files. This is usually a bad idea and should only be attempted with text files that have embedded binary data. --read-lang-def=<file> Load from <file> the language processing filters. (see also --write-lang-def) then use these filters instead of the built-in filters. --script-lang=LANG,<s> Process all files that invoke <s> as a "#!" scripting language with the counter for language LANG. For example, files that begin with "#!/usr/local/bin/perl5.8.8" will be counted with the Perl counter by using --script-lang=Perl,perl5.8.8 The language name is case insensitive but the name of the script language executable, <s>, must have the right case. This option can be specified multiple times. See also --force-lang. --sdir=DIR Use DIR as the scratch directory instead of letting File::Temp chose the location. Files written to this location are not removed at the end of the run (as they are with File::Temp). --skip-uniqueness Skip the file uniqueness check. This will give a performance boost at the expense of counting files with identical contents multiple times (if such duplicates exist). --strip-comments=EXT For each file processed, write to the current directory a version of the file which has blank lines and comments removed. The name of each stripped file is the original file name with ".EXT" appended to it. It is written to the current directory unless <--original-dir> is on. --original-dir Write the stripped files the same directory as the original files. Only effective in combination with --strip-comments. --sum-reports Input arguments are report files previously created with the --report-file option. Makes a cumulative set of results containing the sum of data from the individual report files. Filter Options --exclude-dir=DIR[,DIR ...] Exclude the given comma separated directories from being scanned. For example: --exclude-dir=.cache,test will skip all files that match "/.cache/" or "/test/" as part of their path. Directories named ".cvs" and ".svn" are always excluded. --exclude-lang=LANG[,LANG ...] Exclude the given comma separated languages from being counted. --exclude-list-file=FILE Ignore files whose names appear in FILE. FILE should have one entry per line. Relative path names will be resolved starting from the directory where cloc is invoked. See also --list-file. --match-f=REGEX Only count files whose basenames match the Perl regex. For example this only counts files at start with Widget or widget: --match-f="^[Ww]idge" B>--not-match-f=REGEX> Count all files except those whose basenames match the Perl regex. --skip-win-hidden On Windows, ignore hidden files. Debug Options --categorized=FILE Save names of categorized files to FILE. --counted=FILE Save names of processed source files to FILE. --help Print this usage information and exit. --found=FILE Save names of every file found to FILE. --ignored=FILE Save names of ignored files and the reason they were ignored to FILE. --print-filter-stages Print to STDOUT processed source code before and after each filter is applied. --show-ext[=EXT] Print information about all known (or just the given) file extensions and exit. --show-lang[=LANG] Print information about all known (or just the given) languages and exit. B>-v[=NUMBER]> Turn on verbose with optional numeric value. --version Print the version of this program and exit. B>--write-lang-def=FILE> Writes to FILE the language processing filters then exits. Useful as a first step to creating custom language definitions. See --read-lang-def. Output Options --no3 Suppress third-generation language output. This option can cause report summation to fail f some reports were produced with this option hile others were produced without it.) --progress-rate=NUMBER Show progress update after every NUMBER files are processed (default NUMBER=100). Set NUMBER to 0 to suppress progress output; useful when redirecting output to stdout. --quiet Suppress all information messages except for the final report. --report-file=FILE Write the results to FILE instead of STDOUT. --out=FILE Synonym for --report-file=FILE. --csv Write the results as comma separated values. --sql=FILE Write results as SQL create and insert statements which can be read by a database program such as SQLite. If FILE is 1, output is sent to stdout. --sql-project=NAME Use NAME as the project identifier for the current run. Only valid with the --sql option. --sql-append Append SQL insert statements to the file specified by --sql and do not generate table creation option. --xml Write the results in XML. --xsl[=FILE] Reference FILE as an XSL stylesheet within the XML output. If FILE is not given, writes a default stylesheet, cloc.xsl. This switch forces --xml to be on. --yaml Write the results in YAML. EXAMPLES
None (yet). ENVIRONMENT
None. FILES
None. SEE ALSO
sloccount(1) AUTHORS
Program was written by Al Danial <al.danial@gmail.com> and is Copyright (C) 2006-2010 Northrop Grumman Corporation, released under the GNU GPL version 2 or (at your option) any later version. This manual page was written by Jari Aalto <jari.aalto@cante.net>, for the Debian GNU system (but may be used by others). Updated by Jari Aalto <jari.aalto@cante.net>. Released under license GNU GPL version 2 or (at your option) any later version. For more information about license, visit <http://www.gnu.org/copyleft/gpl.html>. cloc 2012-06-15 cloc(1)
Man Page

Featured Tech Videos