Expand description
Timeline slicing — parsers + application for --after / --before
duration filters, --after-step / --before-step / --range index
filters, and the :@<duration> TUI jump command.
Duration grammar (permissive, case-insensitive):
30s/30sec→ 30 seconds5m/5min→ 5 minutes2h/2hr→ 2 hours1d/1day→ 1 day1h30m/90m30s→ concatenated components, summed- Bare integer → seconds (e.g.
300= 5m)
Range grammar: start..end (exclusive end, mirrors Rust’s
Range<usize>). Open-ended forms: ..500, 100.., or just ..
(no-op). 1-based step numbers internally convert to 0-based so
--range 1..11 = the first 10 steps regardless of format.
Time semantics: --after 2h / --before 10m are relative to the
session’s first step, not to wall-clock now. This is unambiguous
for archived sessions where “now” is meaningless, and matches the
intuitive read of “give me what happened in the first 10 minutes of
this session”. Sessions with no timestamps get a stderr warning and
pass through unfiltered.
Structs§
- Step
Range - Inclusive start, exclusive end, both 0-based.
Functions§
- parse_
duration_ ms - Parse a duration string like
1h30m,45s,2h,90m30s, or a bare integer (seconds). Returns milliseconds. - parse_
step_ range - Parse
start..end,..end,start.., or..into aStepRange. End is always exclusive —1..11means the first ten steps. The CLI surface accepts 1-based numbers; the conversion to 0-based indices happens at the slice site. - slice_
steps - Slice the steps by index range and optional time bounds. Time
bounds are offsets in milliseconds from the session’s first step’s
timestamp. When no step carries a timestamp, time filters are
silently skipped (and the caller gets a stderr warning from
warn_if_time_filter_ignored— kept out here so this function stays pure). - step_
range_ from_ bounds - Build a
StepRangefrom top-level--after-step/--before-stepscalars. Either may beNonefor an open bound. - warn_
if_ time_ filter_ ignored - Print a one-line stderr warning when the user asked for a time
filter but the session has no usable timestamps. Keeps
slice_stepsitself pure.