diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-28 10:03:27 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-28 10:03:27 +0200 |
| commit | b39c8187ef1b87eea084e3c3d2226be5cf320dca (patch) | |
| tree | a12a09c8c4dfd8e69442e616b162d9dcc2dfc6a5 /test | |
| parent | f1d562a3a4d53a707385334ab553b8a6cad36b1b (diff) | |
| download | colitur-b39c8187ef1b87eea084e3c3d2226be5cf320dca.tar.gz colitur-b39c8187ef1b87eea084e3c3d2226be5cf320dca.zip | |
feat(cli): --month, --date and --today narrow a report
--pretty made a report readable and, in the same stroke, ungreppable: a box
spans seven lines, so `grep 2026-03-` returns fragments of March rather than
March. The nearest working equivalent is a paragraph-mode awk incantation that
depends on the boxes happening to be blank-line separated -- knowledge no
reader should need to select a month.
The three flags are ALTERNATIVES, not a stack. Naming two exits 2 rather than
letting one quietly win, the same discipline the positional year and --year
already follow, and the same reason this program refuses a flag it cannot
honour instead of accepting and ignoring it.
--date and --today CARRY a year, so the year becomes optional on those two and
required only after the window has had its say: `colitur day --today` is a
complete command while `colitur day` still is not. A year named alongside them
must agree. The disagreement message names the flag rather than printing two
bare numbers, because with --today the second year appears nowhere on the
command line for the reader to trace.
temporal refuses --year yet accepts --date/--today including as its year
source. That is not a back door to the refused spelling: --year is a second
spelling of the positional year, which temporal deliberately does not offer,
whereas --date selects a DAY and merely happens to determine which year
contains it.
The window is a predicate over an ISO date STRING rather than over a Date.t,
because the two report shapes reach it differently -- resolved days carry a
Date.t, temporal_report carries a flat Record whose date is already text --
and one shared test is one implementation rather than two that can drift.
Accepted by day, readings, rubrics and temporal; refused by easter, emit,
table, render, publish, check, convert, lang, config and new-overlay.
--pretty had shipped undocumented in both --help and colitur(1). Both now
carry it, alongside the new narrowing section; the man page's awk example is
shown precisely so the flag that replaces it is justified.
Default output is byte-identical to 1.1.0 across seven years, five commands
and both rites, and across all five emit formats and the shipped templates.
Diffstat (limited to 'test')
| -rw-r--r-- | test/cli.t | 114 |
1 files changed, 114 insertions, 0 deletions
@@ -2005,3 +2005,117 @@ accepting it and quietly doing nothing: $ colitur easter 2026 --pretty colitur: --pretty has no effect on `easter`; refusing rather than ignoring it [2] + +`--month N`, `--date` and `--today` narrow a report to part of a year. They are +independent of `--pretty` -- the default format narrows too: + + $ colitur day --month 3 2026 | wc -l + 31 + $ colitur day --month 2 2028 | wc -l + 29 + $ colitur day --date 2026-04-05 + 2026-04-05 sunday paschaltide 1 ef-easter-sunday class-1 white Dominica Resurrectionis + +All four row commands honour them, `temporal` included: + + $ colitur readings --rite of --date 2026-12-25 + 2026-12-25 of-nativity | Isai 52:7-10 | Hebr 1:1-6 | Ioann 1:1-18 + $ colitur rubrics --month 2 2026 | wc -l + 28 + $ colitur temporal --date 2026-12-25 + 2026-12-25 friday christmastide - ef-nativity class-1 white + +Under `--pretty` the same narrowing applies, one box per day: + + $ colitur day --pretty --date 2026-04-05 + +--------------------------------------------------------------------------+ + | 2026-04-05 Sunday white | + +--------------------------------------------------------------------------+ + | Dominica Resurrectionis | + | I classis . Tempus Paschatis, week 1 | + +--------------------------------------------------------------------------+ + + +`--today` prints today, whenever today is -- so this asserts the semantics +rather than a fixed string: + + $ [ "$(colitur day --today | cut -d' ' -f1)" = "$(date +%F)" ] && echo same + same + $ colitur day --today | wc -l + 1 + +The three are alternatives, not a stack. Naming two is refused rather than one +of them quietly winning: + + $ colitur day --month 3 --today 2026 + colitur: day: --month and --today are alternatives; name one + [2] + $ colitur day --date 2026-01-01 --month 3 + colitur: day: --month and --date are alternatives; name one + [2] + +Bad values are rejected by the flag that owns them, not by a later failure: + + $ colitur day --month 13 2026 + colitur: day: --month wants a number 1-12, got 13 + [2] + $ colitur day --month abc 2026 + colitur: day: --month wants a number 1-12, got abc + [2] + $ colitur day --date 2026-13-01 + colitur: day: --date 2026-13-01: month 13 out of range 1..12 + [2] + $ colitur day --date 20260401 + colitur: day: --date 20260401: date "20260401": expected YYYY-MM-DD + [2] + $ colitur day --month + colitur: --month needs a number 1-12 + colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> | colitur rubrics <year> | colitur emit --format FMT --from Y --to Y | colitur table --year Y --template FILE | colitur render --template FILE --year Y | colitur publish --from Y --to Y --out DIR | colitur lang --list|--dump CODE|--check FILE | colitur config --show | colitur check FILE | colitur new-overlay (try: colitur --help) + [2] + +`--date` and `--today` NAME a year, so the year may be omitted on those two -- +and must agree when given, the same rule the positional year and `--year` +already follow. (The `sed` masks the current year, nothing else.) + + $ colitur day --date 2026-04-05 | wc -l + 1 + $ colitur day --date 2026-04-05 2027 + colitur: day: year 2027 and --date 2026-04-05 (2026) disagree + [2] + $ colitur day --today 1583 2>&1 | sed 's/(....)/(YYYY)/' + colitur: day: year 1583 and --today (YYYY) disagree + $ colitur day --today 1583 >/dev/null 2>&1 + [2] + +`--month` names no year, so it still needs one: + + $ colitur day --month 3 + colitur: day requires a year (positional, --year, --date or --today) + [2] + +`temporal` refuses `--year` yet takes `--date`/`--today`, including as its +source of a year: `--year` is a second spelling of the positional year, which +`temporal` does not offer, while `--date` selects a DAY and merely happens to +determine which year contains it. + + $ colitur temporal --year 2026 + colitur: --year/--template/--flavour have no effect on `temporal`; refusing rather than ignoring them + [2] + $ colitur temporal --date 2026-12-25 | wc -l + 1 + +Commands that cannot honour them refuse them, rather than accepting and +quietly ignoring: + + $ colitur easter 2026 --today + colitur: --month/--date/--today have no effect on `easter`; refusing rather than ignoring them + [2] + $ colitur emit --from 2026 --to 2026 --format csv --month 3 + colitur: --month/--date/--today have no effect on `emit`; refusing rather than ignoring them + [2] + $ colitur table --year 2026 --template templates/ef/ordo.txt --today + colitur: --month/--date/--today have no effect on `table`; refusing rather than ignoring them + [2] + $ colitur config --show --month 3 + colitur: --month/--date/--today have no effect on `config`; refusing rather than ignoring them + [2] |
