-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Prompts with help #794
Comments
Thank you @jakubka for submitting this proposal. 🙇 I like the fact that cookiecutter.json would work on older cookiecutter versions due to the way it handles That being said, it is not something that would be feasible in the long run as we add more features and also for templates that use numerous variables, such as cookiecutter-django. The proposed solution covers:
However there is more that we have to take into consideration:
Although we don’t need to add all of the above in one go, it’s clear that this won’t really work with just using the JSON file. I think we need a proper plugin system to handle with these requirements. Please feel free to give feedback on that 👍 Again I appreciate you taking the time to submit this request. |
Thanks for the feedback @hackebrot! Much appreciated. Do we have more details about such plugin system somewhere? Do you mean some kind of extension to the current hooks model or something bigger? Has it been discussed? My initial thoughts are that plugin system is over complicated solution for something we want to achieve. I see that there are requests for other features, but how important are they compared to the ones which can be achieved with just having JSON? From your list it looks to me that JSON is good enough for the majority of the items. If we try to develop a perfect solution, we might end up with nothing. I would personally prefer to add features by extending the JSON format, simply because it's the simpler solution.. After the limits of the single JSON config file are hit, a cookiecutter2 with completely different design can be released. But maybe I imagine something bigger and more complicated than you have in mind. Please elaborate. :) |
@hackebrot any chance you can take a look? thanks! |
(cc @huguesv) Since using a dict for the default value is already supported, why not just use more fields on those? [EDIT: I see that PR isn't actually merged... my mistake] We are adding a GUI interface to Visual Studio for cookiecutter (see here for some early screenshots) and would love to be able to use rich information about each field. Nested parameters and templates are less interesting to us, but we're really keen to have value selectors (e.g. pop open a file browser, or a database connection string generator, etc.). We'll happily go our own way with extensions and underscore-prefixed fields if we need to, but we'd obviously much rather have everyone using the same fields so that developers don't have to write multiple entries. |
@zooba the proposal in #360 isn't forward compatible. Meaning that already released That being said, maybe keeping forward compatibility isn't important and we can safely choose the more elegant solution as proposed in the linked PR. This is something I can't decide. Btw I think inclusion in an official VS plugin is a great opportunity for cookiecutter to become even more mainstream. Great to hear! :) cc @audreyr |
Why not add a section to the JSON just for help prompts that can be ignored by old versions and is independent of the values.
|
I think something like what @Cadair is suggesting would be great in the short term. While I agree a plugin system would be great, at the basic level, being able to have more verbose questions is a pretty important feature, and probably not something that should be provided just by a plugin? |
@Cadair your suggestion is practically the same as the original one, except I propose more generic name In future we can very easily add more possible options to the options in Anyway, it looks like this proposal is being superseded by #848 which takes it much further. |
Yes it is practically the same as yours but still using the original default value specification. _help or _parameters is all basically the same. As for #848 it seems that that is justifiably on hold. However, I really feel that at the bare minimum cookiecutter needs a way of printing a help prompt during the question process. |
Has this been subsumed by some other issue and/or implemented elsewhere? #848 also looks stalled, but also looks gigantic. Right now the workaround I have is to print some help text after the user enters all their variables via a Another workaround I concocted is like the below (and just do nothing with {
"help1": "The maintainers should be GitHub usernames. Enter to continue...",
"primary_maintainer": "",
"secondary_maintainer": "",
"help2": "The 'app_name' must be a valid Python module name. Enter to continue...",
"app_name": "example"
}
Are there any better alternatives meanwhile? |
I suppose adding a +1 here isn't productive. However, I'd like to add a workaround for people who stumble upon this to implement their own solution for now. In our project, which builds a framework on top of cookiecutter among other things, what we do is have an optional |
Any progress on this? |
I believe this has been addressed |
This is yet another try at introducing a new
cookiecutter.json
format which will support specifying help text for individual parameters which will be then printed when prompting.There've been several attempts to do that (#249, #30, #381, #433), but all now seem outdated for one reason or another, so I am opening this new issue. I think old ones should be closed to reduce confusion. I've gone through discussions on the above issues/PRs and picked up the good parts.
Ultimately, I would love cookiecutter to be able to prompt for parameters similarly to how sphinx-quickstart does:
![image](https://cloud.githubusercontent.com/assets/4806497/17462164/13154228-5c9c-11e6-8c22-e5e74d91afc9.png)
New cookiecutter.json format
Backwards compatibility has to be considered when designing a new
cookiecutter.json
format. First, the current version ofcookiecutter
should handle the new format. Second, newcookiecutter
should support old format.I propose this new format:
This format will fully handle the backwards compatibility. I acknowledge that writing
cookiecutter.json
will be more difficult from now on, but I think that is an acceptable tradeoff. After all,cookiecutter.json
is written once, but used many many times, so I prefer to optimize for the end user experience.What do you think?
If main contributors are happy with the proposal, I can take care of the code and documentation changes.
The text was updated successfully, but these errors were encountered: