mirror of
https://git.pumpin.online/funkpower/typikon.git
synced 2026-10-23 03:07:12 +00:00
drop the terminal screenshot, and make the examples checkable
The screenshot was a picture of the Python CLI: it predated the formats, the tradition in the header and --typikon, and a picture cannot be diffed against the program anyway. Every example is now a console block of real output. tests/readme-examples.py runs each one and diffs it, which found four things wrong in the process of writing them: the hero example printed today rather than a fixed date, so it was wrong for any reader on any other day; the Ruthenian example depended on whatever the reader's config remembered; a tradition block held two commands and was checking neither; and the JSON had a hand-collapsed array that the program does not emit. It also found a real bug. --typikon could be turned on by the config file and there was no way to turn it off again from the command line, so on this machine showed the Typikon's discipline with no way to ask for the law. --no-typikon now does that. The Rust example is a test rather than prose, for the same reason.
This commit is contained in:
+13
-2
@@ -39,9 +39,14 @@ struct Args {
|
||||
|
||||
/// Show the day at the Typikon's full discipline rather than only what
|
||||
/// your church's particular law requires. Obligations are still reported.
|
||||
#[arg(long)]
|
||||
#[arg(long, conflicts_with = "no_typikon")]
|
||||
typikon: bool,
|
||||
|
||||
/// Show only what your church's particular law requires, overriding a
|
||||
/// `typikon = true` remembered in the config.
|
||||
#[arg(long)]
|
||||
no_typikon: bool,
|
||||
|
||||
/// YYYY-MM-DD (default: today)
|
||||
#[arg(short, long)]
|
||||
date: Option<String>,
|
||||
@@ -345,7 +350,13 @@ fn run() -> Result<i32, String> {
|
||||
Some(t) => jurisdictions::Tradition::parse(t)
|
||||
.ok_or_else(|| format!("unknown tradition {t:?}; try slavic or greek"))?,
|
||||
};
|
||||
let discipline = if args.typikon || saved.typikon {
|
||||
// A flag either way beats the file; with neither, the file decides.
|
||||
let typikon = if args.no_typikon {
|
||||
false
|
||||
} else {
|
||||
args.typikon || saved.typikon
|
||||
};
|
||||
let discipline = if typikon {
|
||||
Some(jurisdictions::RuleKind::Orthodox)
|
||||
} else {
|
||||
base.discipline
|
||||
|
||||
Reference in New Issue
Block a user