-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
It'd be nice to also resolve templates from files #8
Comments
Yeah, a |
Something that might be a bit simpler to implement, and would probably flow better with the rest of the built-in functions is: Hello {{ (jsonfile "data.json").name.first }} $ gomplate -d data.json < in.txt
Hello Joe! |
...although if I'm taking a path or filename as the argument to Conversely, forcing a file to be named a specific way may not be a good plan either. Maybe something like: Hello {{ (jsonfile "data").name.first }} $ gomplate -d data.json < in.txt
Hello Joe! Where $ gomplate -d data=myotherfilename.json < in.txt
Hello Joe! It'd be interesting to also support other data sources from URLs, so to treat the $ gomplate -d data=https://some.url/where/i/can/find/data.json < in.txt
Hello Joe! This implies a few things:
|
I like the "data source alias" idea. Perhaps always use uri style? Like file:// https://? |
yeah - well I was also thinking I could support lots of different formats this way (eventually!) like yaml or toml or even XML, detecting by Content-Type with a fallback to file extension... |
Let's start with JSON support (because
encoding/json
). I figure usage like this would be useful:data.json
in.txt
(where
data
comes from the name of the file)The text was updated successfully, but these errors were encountered: