Skip to content

Instantly share code, notes, and snippets.

View mrestrepo-ecw's full-sized avatar

Mateo Restrepo mrestrepo-ecw

View GitHub Profile
@mrestrepo-ecw
mrestrepo-ecw / lc_type.nu
Last active November 10, 2026 15:44
line count files of a certain type in current dir
# line_count of file as a single int
def line_count [file] {
let mt = (wc -l $file | split column --regex " " )
$mt | get 0 | get column0 | into int
}
def lc_type [ file_type] {
let files = (glob $"**/*.($file_type)" --exclude ["target/**", "tmp/**"])
let lc = $files | each { line_count $in } | math sum
{"file_count": ($files | length), "line_count": $lc }