-
Notifications
You must be signed in to change notification settings - Fork 3
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 template-path to be URL #66
Comments
This is pretty cool idea, thanks for suggesting it! 🙂 Thinking about the implementation, adding command line argument or YAML config option for referencing single URL template would be quite straightforward, but I'm not sure how to do something like referencing folder of templates (like you can do currently on local filesystem). The latter would likely require to add some more sophisticated support for template repositories, etc. What do you think? Or would the option to specify URL templates one by one be sufficient for now? |
Yes, I think this would be awesome to have with separate file URLs at the moment. I completely agree that it is too complicated with folder, but the separate file URL in config/CLI would be fantastic for general use-case! |
Awesome, let's make this happen in upcoming v0.4.1.0 🙂 |
So I started to think about this one and at least for now, there are some open questions that will need to be decided before actually implementing this. I'm mainly just thinking aloud here but maybe @vrom911 you'll also have some ideas about it 🙂 First, for each template file, Headroom needs to know for which type of source code file this template is and what type of template engine to use. In locally stored templates this is specified in template name as Second, I'll really need to rethink how to handle precedence of templates if you define same template from multiple sources. Including this change, Headroom will allow to use 3 different sources of templates. First, built-in templates available under template-priority:
built-in: 1
local: 2
url: 3 What do you think about these points? Would such solution also match your needs? EDIT: Moving this issue to v0.4.2.0 milestone as I need to do another minor release first. |
Hey @vaclavsvejcar! Your proposal looks good to me 👍🏻 Can't wait to use this feature in action 🙂 I have slightly different thoughts about the design. I'm not sure that the benefit of user-specified flexibility worth the implementation cost. I think the built-in functionality should have the lowest priority. You can't change its behaviour and it's always available to you. Also, I think that the As a side note, I'm thinking about native support for Dhall in These are just a few thoughts from my side, and I'm not insisting on any particular implementation 🙂 |
Hello @chshersh, thank you for yout thoughts.
Good point. Regarding the ability to configure the behaviour - I guess I'll just skip this part and implement it if really needed in future. And regarding the priority - I like the idea that "the closer the source to you and the more control over it you have, the higher priority it should have", so let's have it that way 🙂
I know about Dhall, but have zero experience with it. When I was writing Headroom, I choose YAML because just everyone knows it. That's also the reason why I probably wouldn't drop YAML support, but eventually just add Dhall as second way how to configure Headroom. Anyway, I'll check it out and I created follow-up ticket so we can discuss it there 🙂 |
@vaclavsvejcar I totally support your idea of not dropping the first choice of plain config option and providing Dhall only as an additional bonus. I have some experience with Dhall: we generate HLint warnings for |
@chshersh That would be awesome, I'd appreciate any experience with Dhall 🙂 I'll also give it a try right after I'll finish this one with URL-based templates. |
Hello @vrom911 @chshersh, I implemented this change and it's merged in In order to use it, just place the HTTP/HTTPS address where you normally put the local template path, i.e. either as command line option template-paths:
- some/local/rust.mustache
- https://foo.bar/haskell.mustache |
Hi @vaclavsvejcar! Indeed, the previous notification somehow was unnoticed. We've tested the latest version of We tested the configuration and everything is working as expected 👍🏻 Thanks a lot for implementing this feature, it's very helpful! |
Released as part of v0.4.2.0. |
I wonder if you think it could be possible to have something like this. My case is that lots of repositories have the same template we are using through our organization. It would be nice if we could have one template in the dedicated repo and in each particular project's
.headroom.yaml
we could just provide a link in there, instead of adding the templates folder in each project.This is just an idea, I want to see what do you think about it and what options there are 🙂
The text was updated successfully, but these errors were encountered: