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 split and join to templates #265

Merged

Conversation

deitch
Copy link
Contributor

@deitch deitch commented Jan 4, 2017

I will try to add the replace* ones after, but here is a good start. Obviously includes a test line as well. I like how I just tested both in one line. :-)

Per the request for PR from @tgross at #261 (comment)

@deitch
Copy link
Contributor Author

deitch commented Jan 4, 2017

OK, added replace and regexReplace along with an alias regexpReplace.

In your hands!

"join": join,
"replace": replace,
"regexReplace": regexReplace,
"regexpReplace": regexReplace,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the alias? If we were going to have more than one regex option at all I'd rather we match what consul-template did with having both a regexMatch and regexReplaceAll.

If we don't want to implement the regexMatch bool (which doesn't seem unreasonable), then having the name be regexReplaceAll has the added advantage of giving us room to have a "replace n" option down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why the alias?

Um... just because? In all honesty, my first run of tests failed because I made that mistake! Seemed easiest to fix it by aliasing.

I don't care much one way or the other. If we want to use template's replaceAll, regexMatch, regexReplaceAll, I am fine with that. Whatever you want, just let me know, happy to modify, rerun tests and push out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's match consul-template, it'll be easier for end users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, consul template uses replaceAll instead of replace, so if we are going to match, that one too?

@tgross
Copy link
Contributor

tgross commented Jan 4, 2017

Just had the one comment about the field name but other than that LGTM.

@deitch
Copy link
Contributor Author

deitch commented Jan 4, 2017

Changed the field names as requested. Let's leave regexMatch out of it for now.

@tgross
Copy link
Contributor

tgross commented Jan 4, 2017

LGTM. Will merge once Travis gives us the 👍

@tgross tgross merged commit 2601882 into TritonDataCenter:master Jan 4, 2017
@deitch deitch deleted the templates-with-additional-functions branch January 4, 2017 15:20
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

Successfully merging this pull request may close these issues.

2 participants