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

Add pad and indent functions #2

Merged
merged 2 commits into from
Nov 23, 2021

Conversation

iainlane
Copy link
Contributor

Add padleft, padright, indent and nindent functions. These are intended to be included in drone/autoscaler. They are very useful when reading external files into YAML documents, e.g. userdata for spawned instances.

For adding strings to the beginning and end of other strings,
respectively.
To pad each line of the string with n spaces. This is very useful when
including external files in YAML documents, so they remain
syntactically valid.
@iainlane
Copy link
Contributor Author

btw (commenting here since issues are disabled), I noticed that most/all functions have their arguments the wrong way round if you want | from text/template to work. This supplies the result of the left hand side to the last argument on the right, but here in funcmap the input string is the first arg.

@tphoney
Copy link
Contributor

tphoney commented Nov 23, 2021

Hey @iainlane thanks for the change, i added some unit tests too

@tphoney tphoney added the enhancement New feature or request label Nov 23, 2021
@iainlane iainlane deleted the add-pad-and-indent-functions branch July 21, 2022 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants