-
Notifications
You must be signed in to change notification settings - Fork 119
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
Possibility of "if" in templates? #5
Comments
Chris thank you for trying out boilr. What you need is already implemented and can be used as such: {
"ExpertMode": false,
} Default value of ExpertMode will be false and the user will see a boolean prompt for true/false. In template usage:
For more information please take a look at the wiki pages. For creating templates check this page. |
There is a little misunderstanding 😉 I don't want to use So if I define my condition stuff, the user gets asked about this question only if the condition is true.
{
"AppName": "Demo",
"ExpertMode": false,
"FolderName": {
"value": "Demo",
"condition": "ExpertMode"
}
} Example workflows:
2.)
Cheers |
Gotcha I see what you mean 👍 I can make an enhancement as such: {
"AppName": "Demo",
"ExpertMode": {
"FolderName": "Demo",
"RepoNumber: 5,
}
} The workflow:
I'll stew on this a bit more to get a good idea of pros/cons, but the feature is a good one and I'll work on it. Final usage might be a bit different Thanks for bringing this up, I was thinking about this earlier, but got sidetracked and forgot. |
Cool! 👍 And to be a little "challenging": in the same changes, would it be possible to add variables to the default values? i.e. run the default variables through go-templates first. Like:
If this is possible (and easy) too, it would be as awesome as any other template engine! 😉 Well, maybe I'll find the time to implement this one on my own and send you a PR, we'll see. |
Thanks for another good suggestion. I'll see what I can do, but It'd be a good idea to move this suggestion to a new issue just so it doesn't get lost. I welcome any contribution, however at this stage adoption and feedback is more important to me. So, you are already making big contributions thank you 👍 . |
Hey @tmrts
I'm really tempted to use boilr, but one critical feature is missing. I need the possibility to create a condition in the questions. Nothing very complicated, but still. I had the idea of implementing it on my own, but there are so many libraries and tools out there, I didn't want to make "just another templater".
So I found your boilr.
Do you think it would be possible to add an if condition to the project.json?
Like:
Only ask the question about the
FolderName
if the answer toExpertMode
is evaluated truthly.Cheers
Chris
The text was updated successfully, but these errors were encountered: