diff --git a/CHANGELOG.md b/CHANGELOG.md index d05bf4c..2c983d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ replacement, and each removed path, column or flag. under [Names](README.md#names). - 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' | - 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, `{/users}`, is the record `users` under `--format`. An argument other than a flag, an empty or blank stdin, or nothing piped in, exits 2. diff --git a/README.md b/README.md index edff22a..80a2ed3 100644 --- a/README.md +++ b/README.md @@ -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 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'` 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 diff --git a/cmd/fejkdata/main.go b/cmd/fejkdata/main.go index 9ab48d7..620b640 100644 --- a/cmd/fejkdata/main.go +++ b/cmd/fejkdata/main.go @@ -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 ({/geo.SE.locality..municipality.name}). -In text, what you send is what renders, and fejkdata adds nothing: a format string keeps -every byte, so echo's newline ends each render, and printf '%s' 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 null alone is refused. A quoted -heredoc, <<'EOF', passes $, a backslash or a quote as written. +Under --format text, the default, what you send is what renders, and fejkdata adds +nothing: a format string keeps every byte, so echo's newline ends each render, and +printf '%s' 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 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 -template whose fields are its columns, or a lone reference, one reference and nothing -else such as {/sv_SE.person}, one newline after it allowed — and the rows are written as one JSON array, one JSON -object per line, one CSV row (after a header), or one INSERT. +template whose fields are its columns, or a lone reference such as {/sv_SE.person}: +one reference and nothing else, with one newline after it allowed — and the rows are +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) --format F output form: text (default), json, ndjson, csv or sql diff --git a/docs/decisions.md b/docs/decisions.md index 2646b79..e3bc8f2 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -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 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 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 @@ -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 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 -template, as the decision "The CLI renders exactly the template on its stdin, and adds -nothing" records. +choosing. On stdin the CLI drops it, per the decision "The CLI renders exactly the +template on its stdin, and adds nothing". ## `FakeTemplate` and `NewTemplate` both stay