While reading iOS 7 Programming Cookbook, I suddenly wondered how many lines of Obj-c code I wrote.
Before, when I was still using the Windows operating system, I used SourceCounter to do this.
However, SourceCounter doesnβt support Mac OS X.
So, I found an interesting command line:
1
| find . -name "*.m" -or -name "*.h" | xargs grep -v "^$" | wc -l
|
β^$β Empty line
βwc -lβ word count
I still recommend another tool written in Perl
.
CLOC - Count Lines of Code
Install:
Usage
Here is result of my codes
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
| 2014-08-19
http://cloc.sourceforge.net v 1.60 T=20.51 s (67.8 files/s, 4427.5 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C++ 409 5440 4917 21968 C/C++ Header 250 2997 3436 10458 Objective C 298 3999 3720 9616 XML 184 408 97 6725 HTML 27 851 13 4743 Java 110 732 985 4082 C 54 492 533 2046 Assembly 23 234 16 600 Python 19 200 117 435 Go 2 109 21 303 CSS 2 33 7 223 JSP 4 10 0 66 JavaScript 2 0 9 49 YAML 5 16 16 44 Ruby 1 13 3 11 Bourne Shell 1 4 1 7 ------------------------------------------------------------------------------- SUM: 1391 15538 13891 61376 -------------------------------------------------------------------------------
|
Translated by gpt-3.5-turbo