19👍
Yep:
shell]$ find /my/source -name "*.py" -type f -exec cat {} + | wc -l
Job’s a good ‘un.
8👍
You might want to look at CLOC — it’s not Django specific but it supports Python. It can show you lines counts for actual code, comments, blank lines, etc.
- Creating users in django (NOT NULL constraint failed: auth_user.last_login)
- Django: Save user uploads in seperate folders
4👍
Starting with Aiden’s answer, and with a bit of help in a question of my own, I ended up with this god-awful mess:
# find the combined LOC of files
# usage: loc Documents/fourU py html
function loc {
#find $1 -name $2 -type f -exec cat {} + | wc -l
namelist=''
let i=2
while [ $i -le $# ]; do
namelist="$namelist -name \"*.$@[$i]\""
if [ $i != $# ]; then
namelist="$namelist -or "
fi
let i=i+1
done
#echo $namelist
#echo "find $1 $namelist" | sh
#echo "find $1 $namelist" | sh | xargs cat
echo "find $1 $namelist" | sh | xargs cat | wc -l
}
which allows you to specify any number of extensions you want to match. As far as I can tell, it outputs the right answer, but… I thought this would be a one-liner, else I wouldn’t have started in bash, and it just kinda grew from there.
I’m sure that those more knowledgable than I can improve upon this, so I’m going to put it in community wiki.
- Start django shell with a temporary database
- Django : Deduce duplicate key exception from IntegrityError
- How to store google oauth token in django : Storage or database
- Django import-export: only export
0👍
Get wc command on Windows using GnuWin32 (http://gnuwin32.sourceforge.net/packages/coreutils.htm)
wc *.py
- How to build a REST client frontend for a REST API backend?
- Django – how can I access the form field from inside a custom widget
- Django ORM group by, and find latest item of each group (window functions)
- Raising ValidationError from django model's save method?