Reputation: 12444
Does anyone know if it is possible to get the total number of lines of code from all the classes in my project in Objective-C. Right now I am guessing that this is not possible but I just wanted to make sure. If it is possible does anyone know how to do it?
Upvotes: 0
Views: 1033
Reputation: 21
find . -type f -name "*.[mh]" -exec wc -l '{}' \; | awk '{sum+=$1} END {print sum}'
Upvotes: 0
Reputation: 8638
If you like the terminal and have all your files in the same folder, try:
$ wc *.m
To get at the number in your code, you could run it as a shell script build phase that generates a header file for you. E.g.
cd source_folder
wc -l *.m \
| tail -1 \
| awk '{ print "#define kNumberOfLines " $1 }' \
> lines_of_code_header.h
Then include that file and use the constant as you like.
Upvotes: 4