mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
* Allow step -a shift_lag/shift_lead/delta/ratio to specify records back/forward (#1002) Extends the slwin_m_n naming convention to more steppers: shift_lag_12 refers 12 records back, shift_lead_4 refers 4 records forward, and likewise delta_N, ratio_N, and shift_N. The unsuffixed forms keep their existing 1-record-back/forward behavior and output field names. Backward-looking steppers cache copies of previous values in a fixed-size ring buffer (tValueRing) in their own state, following the existing pattern of not reading from the window keeper's already-emitted records, to avoid races with downstream transformers. shift_lead_N uses the existing forward-window machinery shared with slwin. Also adds nil guards to all steppers' process functions for the case where the record at the window center lacks the stepped field, which previously panicked (pre-existing on main, e.g. "mlr step -a delta,shift_lead -f x" or "-a slwin_1_1" over heterogeneous data), and which the new parameterized combinations make easier to reach. Includes unit tests, regression cases 0024-0027, and regenerated help text / docs / man page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Clarify step -a help text: both plain and _{n} stepper forms are valid (#1002) Per review on #2190: descriptions like "E.g. delta_7 for 7 records back" read as if the suffixed form were the only syntax. Reword the shift, shift_lag, shift_lead, delta, and ratio descriptions to state both forms explicitly -- e.g. "Use delta or equivalently delta_1 for the previous record, or delta_{n} for n records back" -- using the {n} placeholder style, and update the matching usage paragraph and reference-verbs prose. Regenerate help-derived docs, man page, and cli-help regression expectation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Give a specific error for invalid stepper count suffixes (#1002) Per review on #2190: "mlr step -a delta_0" (or delta_-1, delta_x, etc.) previously reported the generic 'stepper "delta_0" not found'. Now, when the name prefixes a known count-suffix stepper (shift, shift_lag, shift_lead, delta, ratio) but the suffix is not a positive integer, the error is: mlr step: stepper "delta_0": count must be a positive integer Truly unknown stepper names keep the existing "not found" message. Adds should-fail regression cases for delta_0 and delta_-1, and unit tests for the detection helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| auxents | ||
| bifs | ||
| cli | ||
| climain | ||
| colorizer | ||
| dkvpx | ||
| dsl | ||
| entrypoint | ||
| go-csv | ||
| input | ||
| lib | ||
| mlrval | ||
| output | ||
| parsing | ||
| pbnjay-strptime | ||
| platform | ||
| runtime | ||
| scan | ||
| stream | ||
| terminals | ||
| transformers | ||
| types | ||
| version | ||
| README.md | ||
Please see ../../README-dev.md for an overview; please see each subdirectory for details about it.