Add Editor prompt type
Closed this issue · 5 comments
Inquirer.js has the Editor prompt type, which I've just realized I need in my Python project currently using this inquirer port. Would be happy to help add it, if there are contribution docs or just point me in the right direction!
That sounds like a great feature! But it might be quite challenging work, I am still not 100% familiar with constraints of the current implementation, but this type of question definitely stands out from the given framework.
Unfortunately, there are no contribution docs, but PR will be welcomed! If possible please add test coverage for this.
Few thoughts and pointers:
- Look into
inquirer.renderer.console.__init__
to see how the questions are rendered. - Define a new question in
inquirer.questions
and renderer for it ininquirer.renderer.console
module. - Most work will be in the question's renderer. Maybe you could overload
_process_input()
which would open the editor in a new process._process_input()
is although called only when user press some key (I think), so the mechanism could be that when the renderer reachesEditor
question there would be the typical header with message "press any key to open editor". For example:
[?] Enter your long text: <press any key to open editor>
- The question should honor the $EDITOR env. variable to be able to customize editors
Those are just few thoughts I had, please let me know if you have any future questions.
Thanks for the quick reply!
I've decided to switch to Node for my current project as it is on a deadline and the flexibility of the rxjs features offered by inquirer.js are quite useful. I may open a PR in the future, would love to have a complete python equivalent of inquirer!
That is understandable. Good luck with your project!
Thanks!