diff --git a/dot_zsh_functions b/dot_zsh_functions index 0116f50..df17455 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -116,17 +116,30 @@ function skip { cut -d' ' -f$n- } -# Unique lines of code -# Via https://text.causal.agency/004-uloc.txt -function uloc { - find . -type f \( \ +cmd_loc="find . -type f \( \ -name '*.py' \ -o -name '*.rb' \ -o -name '*.go' \ -o -name '*.java' \ -o -name '*.c' -o -name '*.h' \ -o -name '*.js' \ - \) -exec \cat \{\} \; | sed -e 's/^[ \t]*//;s/[ \t]*$//' | sort -u | wc -l + -o -name '*.tsx' \ + -o -name '*.md' \ + -o -name '*.xml' \ + -o -name '*.groovy' \ + -o -name '*.gradle' \ + -o -name '*.properties' \ + \) -exec \cat \{\} \; | LANG=C LC_CTYPE=C sed -e 's/^[ \t]*//;s/[ \t]*$//'" + +# Unique lines of code +# Via https://text.causal.agency/004-uloc.txt +function uloc { + eval "$cmd_loc | LANG=C LC_CTYPE=C sort -u | wc -l" +} + +# Top lines of code +function toploc { + eval "$cmd_loc | cut -c 1-100 | LANG=C LC_CTYPE=C sort | uniq -c | sort -nr" } # Find files bigger than X size and sort them by size