Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

add bool filter #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions j2cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def render_command(cwd, environ, stdin, argv):
renderer.register_filters({
'docker_link': filters.docker_link,
'env': filters.env,
'bool': bool,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have toBool rather than bool?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 how about both bool and toBool? My application of j2cli is using it to format Ansible jinja, and my existing templates all use bool :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, bool is a builtin data type so in the future if we add more stuff around the same filter then it will be easier to handle the stuff with a diff name.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the docs/README with this PR?

You should update docs anytime you change code; especially when changing a public interface. This PR seems very low-effort.

})
for fname in args.filters:
renderer.import_filters(fname)
Expand Down