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

Adding datasourceExists function #94

Merged
merged 1 commit into from
Feb 3, 2017

Conversation

hairyhenderson
Copy link
Owner

Fixes #93

This does 2 things:

  1. Teaches datasource to be a bit more friendly when an undefined datasource is referenced:
$ echo '{{datasource "test"}}' | gomplate
2017/02/02 21:09:46 Undefined datasource 'test'
  1. Adds a new datasourceExists function to test whether or not a given datasource was defined:
$ echo '{{if (datasourceExists "test")}}{{datasource "test"}}{{else}}no worries{{end}}' | gomplate
no worries

Signed-off-by: Dave Henderson dhenderson@gmail.com

Signed-off-by: Dave Henderson <dhenderson@gmail.com>
@hairyhenderson
Copy link
Owner Author

@bartmeuris what do you think of this as a fix for #93?

@bartmeuris
Copy link

Looks good, pretty much what I had in mind. Sorry I couldn't submit a PR myself, currently a bit time-constrained. Code looks pretty clean and straight-forward :)

@hairyhenderson
Copy link
Owner Author

@bartmeuris 👍

@hairyhenderson hairyhenderson merged commit c0076a7 into master Feb 3, 2017
@hairyhenderson hairyhenderson deleted the add-datasourceExists-func-93 branch February 3, 2017 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants