-
I'd like to set some private variables based on input from the user. For example, I want to slugify the project name and use that throughout my template. Right now we're looking at doing something like this: project_slug:
when: false
default: "{{ project_name | lower | replace(' ', '-') }}" is there a cleaner way to do this than using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This answered my question: #678 |
Beta Was this translation helpful? Give feedback.
-
Just for reference, this is what I was trying to do: service_name_slug:
when: false # don't prompt for input
default: "{{ service_name | lower | replace(' ', '-') }}"
service_name_stripped:
when: false # don't prompt for input
default: "{{ service_name | lower | replace(' ', '') }}"
service_name_pascal:
when: false # don't prompt for input
default: "{{ service_name.split(' ') | map('title') | join }}"
service_name_camel:
when: false # don't prompt for input
default: "{{ service_name.split(' ') | first | lower }}{{ (service_name.split())[1:] | map('title') | join }}" It kind of sucks there's no built-in way to create these "internal" variables without installing an extension. I had thought I would be able to instruct our users to install copier via |
Beta Was this translation helpful? Give feedback.
This answered my question: #678