Skip to main content

Module shell_init

Module shell_init 

Source
Expand description

Shell-init profile reader, aggregator, and rotation.

Profile files are written by the timing wrapper that crate::shell::generate_init_script embeds in dodot-init.sh. Each shell startup emits one TSV under <data_dir>/probes/shell-init/profile-<unix_ts>-<pid>-<rand>.tsv with the shape:

# dodot shell-init profile v1
# shell\tbash 5.3.9(1)-release
# start_t\t1714000000.123456
# init_script\t/home/alice/.local/share/dodot/shell/dodot-init.sh
# columns\tphase\tpack\thandler\ttarget\tstart_t\tend_t\texit_status
path\tvim\tpath\t/home/alice/dotfiles/vim/bin\t1714000000.123500\t1714000000.123502\t0
source\tvim\tshell\t/home/alice/dotfiles/vim/aliases.sh\t1714000000.123600\t1714000000.124900\t0
# end_t\t1714000000.125100

Both the reader and the rotator are tolerant of malformed input — a partial write from a crashed shell should leave the next dodot probe shell-init working, just with a short report.

Structs§

GroupedProfile
Aggregate one profile by (pack, handler) for the rendered table.
Profile
A whole profile file, post-parse.
ProfileEntry
One parsed entry row from a profile TSV.
ProfileGroup

Functions§

group_profile
Roll up a profile into per-(pack, handler) groups for display.
parse_profile
Parse the textual content of a profile file. Tolerates missing preamble lines, unknown comments, and malformed rows (skipped).
read_latest_profile
Read the most recently written profile under <data_dir>/probes/shell-init/, or None if the directory is empty / missing.
rotate_profiles
Prune <data_dir>/probes/shell-init/ to the newest keep files (by filename). Returns the number of files removed. keep == 0 is treated as “no pruning” — we don’t want a stray miscalibrated config to wipe the whole profile history.