Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow indent to skip first line #54

Closed
calind opened this issue Sep 8, 2017 · 2 comments
Closed

Allow indent to skip first line #54

calind opened this issue Sep 8, 2017 · 2 comments

Comments

@calind
Copy link

calind commented Sep 8, 2017

We are using indent function in helm templates to generate yaml files. In lots of places we need to indent stuff, but that breaks template indentations (see below).

  resources:
{{ .Values.resources | indent 4 }}

Jinja indent filter allows skipping the first line. I think that would be useful so that we can write templates as the following snippet which allows keeping the natural indentation in template files:

  resources:
    {{ .Values.resources | indent 4 true }}
@keitwb
Copy link

keitwb commented Jan 25, 2018

To anyone who is interested in this functionality, you can achieve the same thing by piping the result of the indent to trim:

    resources:
      {{ .Values.resources | indent 4 | trim }}

This will remove the whitespace from the first line, but the indentation of the template block will make up for it.

@mattfarina
Copy link
Member

Because this can be accomplished with pipelines and existing functions I'm going to go ahead and close this. Thanks for the suggestion and the way of doing it today.

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

No branches or pull requests

3 participants