summaryrefslogtreecommitdiff
path: root/test/cli.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/cli.t')
-rw-r--r--test/cli.t157
1 files changed, 157 insertions, 0 deletions
diff --git a/test/cli.t b/test/cli.t
index 22890c1..f604872 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -1962,3 +1962,160 @@ the file is loaded once, unconditionally, before dispatch:
$ XDG_CONFIG_HOME=xdg-bad colitur day 2027 --raw
colitur: xdg-bad/colitur/config.ini: line 1: "[defaults" looks like a section header but does not end with ']'
[2]
+
+`--pretty` lays the four row commands out for a person rather than for awk.
+Opt-in: the default output above is untouched, byte for byte. Colour appears
+only on a terminal, so this test -- which is a pipe -- sees the letter
+fallback (w/r/g/v/o/k) rather than escape sequences:
+
+ $ colitur day --pretty 2026 | head -1
+ +--------------------------------------------------------------------------+
+
+A commemoration takes its own indented line rather than lengthening the row:
+
+ $ colitur day --pretty 2026 | sed -n '/2026-01-14/,+1p'
+ | 2026-01-14 Wednesday white |
+ +--------------------------------------------------------------------------+
+
+`readings --pretty` labels and stacks the citations, and prints the OF second
+reading only on the days that have one:
+
+ $ colitur readings --rite of --pretty 2026 | head -4
+ +--------------------------------------------------------------------------+
+ | 2026-01-01 Thursday |
+ +--------------------------------------------------------------------------+
+ | of-mary-mother-of-god |
+
+NO_COLOR is honoured on presence, whatever its value -- that is the
+convention's own rule, and reading it as a boolean is how tools get it wrong:
+
+ $ NO_COLOR=0 colitur day --pretty 2026 | head -1 | cat -v | grep -c 'ESC'
+ 0
+ [1]
+
+The commands that already choose their own shape refuse it, rather than
+accepting it and quietly doing nothing:
+
+ $ colitur emit --from 2026 --to 2026 --format csv --pretty
+ colitur: --pretty has no effect on `emit`; refusing rather than ignoring it
+ [2]
+ $ colitur table --year 2026 --template templates/ef/ordo.txt --pretty
+ colitur: --pretty has no effect on `table`; refusing rather than ignoring it
+ [2]
+ $ 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]