Skip to content

Instantly share code, notes, and snippets.

@birchb1024
Created October 13, 2023 06:31
Show Gist options
  • Save birchb1024/0c7af5bc8f6618f89b0eaeb1779ee589 to your computer and use it in GitHub Desktop.
Save birchb1024/0c7af5bc8f6618f89b0eaeb1779ee589 to your computer and use it in GitHub Desktop.
Use cloc to report SLOC for the api repos in the current directory
#!/Users/bill.birch/workspace/gocode/bin/elvish
#
# Get lines of code for the repos in the current directory
#
find api* -maxdepth 0 -type d | ^
each {|D|
cloc --exclude-dir=generated -json --timeout 0 $D ^
| from-json ^
| put [$D (one)[SUM][code]]
} | order &reverse=$true &key={|L| put $L[1]} ^
| each {|L| printf "%s %d\n" $L[0] $L[1]} ^
| column -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment