1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
|
# Copyright
#
# Copyright (C) 2009-2010 Jari Aalto
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Description
#
# To learn what TOP LEVEL section to use in manual pages,
# see POSIX/Susv standard and "tility Description Defaults" at
# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11
#
# This is manual page in Perl POD format. Read more at
# http://perldoc.perl.org/perlpod.html or run command:
#
# perldoc perlpod | less
#
# To check the syntax:
#
# podchecker *.pod
#
# Create manual page with command:
#
# pod2man PAGE.N.pod > PAGE.N
=pod
=head1 NAME
cloc - statistics utility to count lines of code
=head1 SYNOPSIS
cloc [options] <FILE|DIR> ...
=head1 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.
=head1 OPTIONS
=head2 Input Options
=over 4
=item B<--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 'E<gt>FILEE<lt>' 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 Files\WinZip\WinZip32.exe\" -e -o >FILE<
=item B<--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
B<--exclude-list-file>
=item B<--unicode>
Check binary files to see if they contain Unicode expanded ASCII text.
This causes performance to drop noticably.
=back
=head2 Processing Options
=over 4
=item B>--by-file>
Report results for every source file encountered.
=item B<--by-file-by-lang>
Report results for every source file encountered in addition to
reporting by language.
=item B<--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 B<--script-lang>.
=item B<--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.
=item B<--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.
=item B<--script-lang=LANG,<s>>
Process all files that invoke <s> as a C<#!> scripting language with the
counter for language LANG. For example, files that begin with
C<#!/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 B<--force-lang>.
=item B<--sdir=DIR>
Use DIR as the scratch directory instead of letting I<File::Temp> chose
the location. Files written to this location are not removed at the
end of the run (as they are with I<File::Temp>).
=item B<--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).
=item B<--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 C<.EXT> appended to it.
It is written to the current directory unless <--original-dir> is on.
=item B<--original-dir>
Write the stripped files the same directory as the original files.
Only effective in combination with B<--strip-comments>.
=item B<--sum-reports>
Input arguments are report files previously created with the
B<--report-file> option. Makes a cumulative set of results containing
the sum of data from the individual report files.
=back
=head2 Filter Options
=over 4
=item B<--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 C</.cache/> or C</test/> as part of
their path. Directories named C<.cvs> and C<.svn> are always excluded.
=item B<--exclude-lang=LANG[,LANG ...]>
Exclude the given comma separated languages from being counted.
=item B<--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 B<--list-file>.
=item B<--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"
=item B>--not-match-f=REGEX>
Count all files except those whose basenames match the Perl regex.
=item B<--skip-win-hidden>
On Windows, ignore hidden files.
=back
=head2 Debug Options
=over 4
=item B<--categorized=FILE>
Save names of categorized files to FILE.
=item B<--counted=FILE>
Save names of processed source files to FILE.
=item B<--help>
Print this usage information and exit.
=item B<--found=FILE>
Save names of every file found to FILE.
=item B<--ignored=FILE>
Save names of ignored files and the reason they were ignored to FILE.
=item B<--print-filter-stages>
Print to STDOUT processed source code before and after each filter is
applied.
=item B<--show-ext[=EXT]>
Print information about all known (or just the given) file extensions
and exit.
=item B<--show-lang[=LANG]>
Print information about all known (or just the given) languages and
exit.
=item B>-v[=NUMBER]>
Turn on verbose with optional numeric value.
=item B<--version>
Print the version of this program and exit.
=item 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
B<--read-lang-def>.
=back
=head2 Output Options
=over 4
=item B<--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.)
=item B<--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 I<stdout>.
=item B<--quiet>
Suppress all information messages except for the final report.
=item B<--report-file=FILE>
Write the results to FILE instead of STDOUT.
=item B<--out=FILE>
Synonym for B<--report-file=FILE>.
=item B<--csv>
Write the results as comma separated values.
=item B<--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
I<stdout>.
=item B<--sql-project=NAME>
Use NAME as the project identifier for the current run. Only valid
with the B<--sql> option.
=item B<--sql-append>
Append SQL insert statements to the file specified
by B<--sql> and do not generate table creation
option.
=item B<--xml>
Write the results in XML.
=item B<--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
B<--xml> to be on.
=item B<--yaml>
Write the results in YAML.
=back
=head1 EXAMPLES
None (yet).
=head1 ENVIRONMENT
None.
=head1 FILES
None.
=head1 SEE ALSO
sloccount(1)
=head1 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>.
=cut
|