Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
+1
-1
@@ -28,7 +28,7 @@ replacement, and each removed path, column or flag.
|
|||||||
under [Names](README.md#names).
|
under [Names](README.md#names).
|
||||||
- First release: the CLI, the library and the shipped data set.
|
- First release: the CLI, the library and the shipped data set.
|
||||||
- The CLI renders exactly the template on its stdin, `echo '{/sv_SE.person} hihi' |
|
- The CLI renders exactly the template on its stdin, `echo '{/sv_SE.person} hihi' |
|
||||||
fejkdata`, and adds nothing to text: `echo`'s newline ends the render, and `--separator`
|
fejkdata`, and adds nothing under `--format text`: `echo`'s newline ends the render, and `--separator`
|
||||||
defaults to empty. Whitespace around a JSON template is dropped. A lone reference,
|
defaults to empty. Whitespace around a JSON template is dropped. A lone reference,
|
||||||
`{/users}`, is the record `users` under `--format`. An argument other than a flag, an
|
`{/users}`, is the record `users` under `--format`. An argument other than a flag, an
|
||||||
empty or blank stdin, or nothing piped in, exits 2.
|
empty or blank stdin, or nothing piped in, exits 2.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ inside one: each dot segment descends one level — folders, then the category (
|
|||||||
file), then fields — and `[SE]` after a [table](#table) selects its row. `--list` prints
|
file), then fields — and `[SE]` after a [table](#table) selects its row. `--list` prints
|
||||||
these paths; a template reads one as `{/path}`.
|
these paths; a template reads one as `{/path}`.
|
||||||
|
|
||||||
In text, what you send is what renders, and fejkdata adds nothing. A format string keeps every
|
Under `--format text`, the default, what you send is what renders, and fejkdata adds nothing. A format string keeps every
|
||||||
byte, so `echo`, a file or a heredoc ends each render with its newline, and `printf '%s'`
|
byte, so `echo`, a file or a heredoc ends each render with its newline, and `printf '%s'`
|
||||||
sends none; `-n` joins renders with `--separator`, empty by default. A JSON template is
|
sends none; `-n` joins renders with `--separator`, empty by default. A JSON template is
|
||||||
an object, array or string, and the whitespace around it is dropped; `42`, `true` or
|
an object, array or string, and the whitespace around it is dropped; `42`, `true` or
|
||||||
|
|||||||
+10
-8
@@ -42,16 +42,18 @@ path into one ({/sv_SE.person.last}), a table's row by key or name
|
|||||||
({/misc.territory[SE]}), and .. steps up from a row to the row it links to
|
({/misc.territory[SE]}), and .. steps up from a row to the row it links to
|
||||||
({/geo.SE.locality..municipality.name}).
|
({/geo.SE.locality..municipality.name}).
|
||||||
|
|
||||||
In text, what you send is what renders, and fejkdata adds nothing: a format string keeps
|
Under --format text, the default, what you send is what renders, and fejkdata adds
|
||||||
every byte, so echo's newline ends each render, and printf '%s' sends none. -n
|
nothing: a format string keeps every byte, so echo's newline ends each render, and
|
||||||
joins renders with --separator, empty by default. A JSON template is an object, array
|
printf '%s' sends none. -n joins renders with --separator, empty by default. A JSON
|
||||||
or string, and the whitespace around it is dropped; 42, true or null alone is refused. A quoted
|
template is an object, array or string, and the whitespace around it is dropped; 42,
|
||||||
heredoc, <<'EOF', passes $, a backslash or a quote as written.
|
true or null alone is refused. A quoted heredoc, <<'EOF', passes $, a backslash or a
|
||||||
|
quote as written.
|
||||||
|
|
||||||
With --format json, ndjson, csv or sql the template must be a record — a JSON
|
With --format json, ndjson, csv or sql the template must be a record — a JSON
|
||||||
template whose fields are its columns, or a lone reference, one reference and nothing
|
template whose fields are its columns, or a lone reference such as {/sv_SE.person}:
|
||||||
else such as {/sv_SE.person}, one newline after it allowed — and the rows are written as one JSON array, one JSON
|
one reference and nothing else, with one newline after it allowed — and the rows are
|
||||||
object per line, one CSV row (after a header), or one INSERT.
|
written as one JSON array, one JSON object per line, one CSV row (after a header), or
|
||||||
|
one INSERT.
|
||||||
|
|
||||||
-d, --data-path D a data directory to layer over the shipped data (repeatable; last wins on a clash)
|
-d, --data-path D a data directory to layer over the shipped data (repeatable; last wins on a clash)
|
||||||
--format F output form: text (default), json, ndjson, csv or sql
|
--format F output form: text (default), json, ndjson, csv or sql
|
||||||
|
|||||||
+3
-4
@@ -78,7 +78,7 @@ folder. `IsTemplate` exports the rule, so struct tags and any other caller read
|
|||||||
|
|
||||||
The template comes from stdin, from `echo`, a file or a heredoc, so one command line gets
|
The template comes from stdin, from `echo`, a file or a heredoc, so one command line gets
|
||||||
a value and a quoted heredoc needs no escape. A format string is stdin's every byte, and
|
a value and a quoted heredoc needs no escape. A format string is stdin's every byte, and
|
||||||
fejkdata adds no newline of its own to text: `echo` ends each render with its newline,
|
fejkdata adds no newline of its own under `--format text`: `echo` ends each render with its newline,
|
||||||
`printf '%s'` sends none, and `-n` joins renders with `--separator`, empty by default. A
|
`printf '%s'` sends none, and `-n` joins renders with `--separator`, empty by default. A
|
||||||
bench of the README's personas picked this on 2026-10-07 over dropping a newline or
|
bench of the README's personas picked this on 2026-10-07 over dropping a newline or
|
||||||
adding one: a rule a user states in one sentence, at the cost of `printf` or a
|
adding one: a rule a user states in one sentence, at the cost of `printf` or a
|
||||||
@@ -114,9 +114,8 @@ until item 129: it reads a path, and only the data is absent.
|
|||||||
|
|
||||||
Padding is the one place the two readings disagree — a format string renders it, JSON
|
Padding is the one place the two readings disagree — a format string renders it, JSON
|
||||||
drops it — so `NewTemplate` names the spelling that renders rather than silently
|
drops it — so `NewTemplate` names the spelling that renders rather than silently
|
||||||
choosing. On stdin the maintainer ruled the whitespace around JSON no part of the
|
choosing. On stdin the CLI drops it, per the decision "The CLI renders exactly the
|
||||||
template, as the decision "The CLI renders exactly the template on its stdin, and adds
|
template on its stdin, and adds nothing".
|
||||||
nothing" records.
|
|
||||||
|
|
||||||
## `FakeTemplate` and `NewTemplate` both stay
|
## `FakeTemplate` and `NewTemplate` both stay
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user