code / scripts

Lines748 Shell528 Python72 Lua67 Bourne Again Shell62 make15
1 others 4
Markdown4
(10 lines)
1 #!/bin/sh
2 # Count lines of code in a git repo (fetching from a URL into a tmp dir first, if needed)
3 if [ -n "$1" ] && ! [ -e "$1" ]; then
4 tmpdir="$(mktemp -d /tmp/git-cloc.XXXXXX)"
5 trap 'rm -rf "$tmpdir"' EXIT
6 git clone --depth 1 "$1" "$tmpdir"
7 cloc "$tmpdir"
8 else
9 cloc --vcs=git
10 fi