Problem
fstache render currently accepts JSON render data only through --data PATH:
fstache render --data data.json < page.mustache > page.html
That works for files, but it is awkward for quick one-off renders, smoke tests, docs examples, and shell scripts that already have a small JSON object available inline.
Users have to create a temporary file or use shell-specific process substitution instead of writing the data directly in the command.
Proposed CLI
Add an inline JSON option, for example:
fstache render --json {"name":"Ada"} < page.mustache
--data PATH should remain the file-based option.
Design questions
- Should
--json and --data be mutually exclusive?
- Should
--json - mean read JSON from stdin, or should stdin stay reserved for the template?
- Should invalid inline JSON reuse the same diagnostic style as invalid
--data files?
Expected behavior
- Inline JSON is parsed as the render data object.
- Invalid inline JSON exits non-zero without a traceback.
- The existing
--data PATH behavior remains unchanged.
- The README CLI section documents the new option with a short example.
Problem
fstache rendercurrently accepts JSON render data only through--data PATH:That works for files, but it is awkward for quick one-off renders, smoke tests, docs examples, and shell scripts that already have a small JSON object available inline.
Users have to create a temporary file or use shell-specific process substitution instead of writing the data directly in the command.
Proposed CLI
Add an inline JSON option, for example:
fstache render --json {"name":"Ada"} < page.mustache--data PATHshould remain the file-based option.Design questions
--jsonand--databe mutually exclusive?--json -mean read JSON from stdin, or should stdin stay reserved for the template?--datafiles?Expected behavior
--data PATHbehavior remains unchanged.