8000 Handle omitted data and stdin data in command-line rendering by Aschenbath · Pull Request #136 · noahmorrison/chevron · GitHub
[go: up one dir, main page]

Skip to content

Handle omitted data and stdin data in command-line rendering - #136

Open
Aschenbath wants to merge 1 commit into
noahmorrison:mainfrom
Aschenbath:fix/read-data-from-stdin-77
Open

Aschenbath wants to merge 1 commit into
noahmorrison:mainfrom
Aschenbath:fix/read-data-from-stdin-77

Conversation

@Aschenbath
Copy link
Copy Markdown

Fixes #77 and #124.

chevron template.mustache --data - now reads data from standard input through the existing JSON/YAML loader. The dash is special only for the data argument, so the template remains a file and both arguments cannot consume the same stream. Standard input is left open.

Omitting --data now passes None to main(), which already supports an empty data object. Previously argparse supplied {}, and main() tried to open that dictionary as a filename, raising TypeError.

Add command-line and API regressions for stdin, omitted data, invalid paths, and stdin ownership, plus the usage example. The prescribed python test_spec.py runner passes all 147 tests, including the pinned Mustache specification tests, on Python 3.12 / Windows. Three new cases fail on the unchanged source. Flake8 adds no diagnostics over the four existing changed-file diagnostics. Other Python versions were not run.

Developed and tested with OpenAI Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DATA parameter should directly support stdin

1 participant

0