Skip to main content

Module files

Module files 

Source
Expand description

Filesystem + JSON helpers shared by the collectors.

Functions§

dir_basename
Last path component of a working directory (/a/b/app → app), or None.
env_path
A non-empty environment variable as a path.
modified_since
false only when the file’s mtime is known and older than start — cheap pre-filter so untouched history is never parsed.
num
A JSON number as u64: accepts integers and floats, clamps negatives to 0.
num_any
First of keys present in obj as a number (aliases across versions).
num_f
An optional JSON number (already deserialised as f64) as u64: clamps negatives and NaN to 0. Used by the typed per-line parsers.
project_from_dirname
-Users-me-Projects-app- → Users-me-Projects-app.
read_lines
Stream the lines of a (possibly huge) file; invalid UTF-8 lines are skipped.
split_paths
Split a path-list environment value (: / ; / , separated).
walk_ext
Recursively collect files below root whose extension is one of exts (case-sensitive, without the dot). Unreadable directories are skipped.