Skip to content

Commit

Permalink
refactor: set default value for keep_trailing_newline more idiomati…
Browse files Browse the repository at this point in the history
…cally
  • Loading branch information
sisp committed Oct 13, 2024
1 parent 3c39738 commit d0b3e26
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions copier/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,10 @@ def envops(self) -> Mapping[str, Any]:
See [envops][].
"""
result = self.config_data.get("envops", {})
if "keep_trailing_newline" not in result:
# NOTE: we want to keep trailing newlines in templates as this is what a
# user will most likely expects as a default.
# See https://github.com/copier-org/copier/issues/464
result["keep_trailing_newline"] = True
# NOTE: we want to keep trailing newlines in templates as this is what a
# user will most likely expects as a default.
# See https://github.com/copier-org/copier/issues/464
result.setdefault("keep_trailing_newline", True)
return result

@cached_property
Expand Down

0 comments on commit d0b3e26

Please sign in to comment.