How many lines does your project have? Linux/bash line calculator!
#1

When a gamemode project goes big, there's much of a chance it has hell loads of files in a certain directory structure.

How to count the overall lines of code there?

I've seen both people asking and people who did in some really tricky ways.
It made me think about sharing my solution as it's probably the simplest approach that can be made.

Код:
for a in $(find $1 -iname "*.pwn"|grep -v deprecated); do echo `wc -l $a`|awk '{print $1}'; done > linez && value=0; while read var; do value=`expr $value + $var`; done < linez; echo $value && rm -f linez
Simply paste it on Bash shell console while being in your project's root directory.

Be carefull: this simple inline bash script implies that you got "deprecated" within your deprecated filenames and that all your scripts have the .pwn extension (no .inc or .own will be calculated). Those basically are some of my conventions (mostly cause .inc could literally be everything; from C, or PHP to Perl or Pawn, and .own is a new format name made because... it's some1s signature?), but I'm certain that most of you would be able to find and eventually change those restrictions if needed. Also it will calculate all the filterscript and gamemode files used, but i assume your gamemode is optimized to have only the required files.

As an example of how it works, here's my project result:

Код:
(gameserver(pts/3)home trunk)$ for a in $(find $1 -iname "*.pwn"|grep -v deprecated); do echo `wc -l $a`|awk '{print $1}'; done > linez && value=0; while read var; do value=`expr $value + $var`; done < linez; echo $value && rm -f linez
13129
Good luck!
Reply
#2

Awesome work Kyeno, as always
Reply
#3

Thanks Matthias
Reply
#4

/bump

Useful, cheers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)