Skip to content
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

Add Editor prompt type #66

Closed
KorySchneider opened this issue May 15, 2019 · 5 comments
Closed

Add Editor prompt type #66

KorySchneider opened this issue May 15, 2019 · 5 comments

Comments

@KorySchneider
Copy link

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!

@AuHau
Copy link
Collaborator

AuHau commented May 15, 2019

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 in inquirer.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 reaches Editor 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.

@KorySchneider
Copy link
Author

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!

@AuHau
Copy link
Collaborator

AuHau commented May 15, 2019

That is understandable. Good luck with your project!

@KorySchneider
Copy link
Author

Thanks!

AuHau added a commit that referenced this issue May 23, 2019
Implements new Editor question as described in #66.
@AuHau
Copy link
Collaborator

AuHau commented May 23, 2019

Implemented and merged in #71

@AuHau AuHau closed this as completed May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants