aboutsummaryrefslogtreecommitdiff
path: root/test/cli.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/cli.t')
-rw-r--r--test/cli.t99
1 files changed, 87 insertions, 12 deletions
diff --git a/test/cli.t b/test/cli.t
index 9ea7beb..e0a0058 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -1258,10 +1258,13 @@ literally either):
$ XDG_CONFIG_HOME=xdg-test colitur config --show
config file: xdg-test/colitur/config.ini (not found)
- lang la (default)
- template (none) (default)
- format (none) (default)
- overlay (none) (default)
+ lang la (default)
+ template (none) (default)
+ format (none) (default)
+ sigla_style la (default)
+ sigla_book abbr (default)
+ sigla_tradition vulgate (default)
+ overlay (none) (default)
A flag on the SAME command line previews exactly what it would resolve to
on any other command -- `overlay` has no single scalar value, so it is
@@ -1269,10 +1272,13 @@ listed one line per effective entry instead:
$ XDG_CONFIG_HOME=xdg-test colitur config --show --lang fr --overlay mine.sexp
config file: xdg-test/colitur/config.ini (not found)
- lang fr (flag)
- template (none) (default)
- format (none) (default)
- overlay mine.sexp (flag)
+ lang fr (flag)
+ template (none) (default)
+ format (none) (default)
+ sigla_style fr (default)
+ sigla_book abbr (default)
+ sigla_tradition vulgate (default)
+ overlay mine.sexp (flag)
A real config file supplies a default that a command with no explicit flag
then uses. An unrecognised key and an unrecognised section are each warned
@@ -1284,13 +1290,82 @@ differently from a misspelled key inside a recognised one:
$ printf '[defaults]\nlang = en\noverlay = /nonexistent/parish.sexp\nbogus = 1\n\n[deafults]\nlang = xx\n' > xdg-test/colitur/config.ini
$ XDG_CONFIG_HOME=xdg-test colitur config --show
config file: xdg-test/colitur/config.ini (exists)
- lang en (config)
- template (none) (default)
- format (none) (default)
- overlay /nonexistent/parish.sexp (config)
+ lang en (config)
+ template (none) (default)
+ format (none) (default)
+ sigla_style en (default)
+ sigla_book abbr (default)
+ sigla_tradition vulgate (default)
+ overlay /nonexistent/parish.sexp (config)
colitur: xdg-test/colitur/config.ini: unknown setting "bogus" (ignored)
colitur: xdg-test/colitur/config.ini: unknown section [deafults] (ignored)
+`--sigla-style`/`--sigla-book`/`--sigla-tradition` (Task 8) resolve through
+the identical flag > config > default precedence as --lang/--template/
+--format, each reported by its own row. `sigla_style` defaults to the
+RESOLVED language, not a literal "la" -- a booklet that asked for a
+different --lang gets its citations in that language too unless told
+otherwise. Run through a fresh XDG_CONFIG_HOME, so this does not depend on
+the config file the earlier examples left behind:
+
+ $ XDG_CONFIG_HOME=xdg-sigla colitur config --show --sigla-style pl --sigla-book full --sigla-tradition modern
+ config file: xdg-sigla/colitur/config.ini (not found)
+ lang la (default)
+ template (none) (default)
+ format (none) (default)
+ sigla_style pl (flag)
+ sigla_book full (flag)
+ sigla_tradition modern (flag)
+ overlay (none) (default)
+
+An unrecognised `--sigla-book` is a hard usage ERROR -- exit 2, one line on
+stderr -- the same discipline an unrecognised `--lang` gets, never a silent
+fallback: `Colitur_citation.Render.with_book` takes a closed variant, not an
+arbitrary string, so anything other than "full"/"abbr" could never mean
+anything downstream.
+
+ $ XDG_CONFIG_HOME=xdg-sigla colitur config --show --sigla-book bogus
+ config file: xdg-sigla/colitur/config.ini (not found)
+ lang la (default)
+ template (none) (default)
+ format (none) (default)
+ sigla_style la (default)
+ colitur: unknown --sigla-book "bogus" (want "full" or "abbr")
+ [2]
+
+An unrecognised `--sigla-tradition`, by contrast, is NOT fatal: it is
+resolved for real against lang/traditions.ini (the same reader a future
+renderer will use), and a name matching no section there degrades to the
+Vulgate with a warning on stderr, exactly as an unknown tradition does
+everywhere else in this project -- asking for a renumbering is optional the
+way asking for a language is not, so a run is not lost over a typo here.
+The warning itself carries lang/traditions.ini's own resolved PATH, which is
+absolute and build-tree-specific -- grepped for rather than matched in
+full, the same way the pre-existing "unknown language" case above already
+sidesteps that same non-portability:
+
+ $ XDG_CONFIG_HOME=xdg-sigla colitur config --show --sigla-tradition nonsense 2>/dev/null
+ config file: xdg-sigla/colitur/config.ini (not found)
+ lang la (default)
+ template (none) (default)
+ format (none) (default)
+ sigla_style la (default)
+ sigla_book abbr (default)
+ sigla_tradition nonsense (flag)
+ overlay (none) (default)
+ $ XDG_CONFIG_HOME=xdg-sigla colitur config --show --sigla-tradition nonsense 2>&1 >/dev/null | grep -c 'no tradition "nonsense"; falling back to the Vulgate'
+ 1
+
+`--sigla-style`/`--sigla-book`/`--sigla-tradition` have no effect on any
+other command yet -- resolving and reporting them is all this build does;
+actually rendering a citation through them is a later task -- refused
+rather than silently ignored, the same discipline `--dump`/`--check`/
+`--list`/`--show` already get above:
+
+ $ colitur day 2027 --sigla-style la > /dev/null
+ colitur: --sigla-style/--sigla-book/--sigla-tradition have no effect on `day`; refusing rather than ignoring them
+ [2]
+
`config` requires --show:
$ colitur config