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

Integrating Enquirer with a browser UI? #17

Closed
mmikitka opened this issue Jun 26, 2017 · 8 comments
Closed

Integrating Enquirer with a browser UI? #17

mmikitka opened this issue Jun 26, 2017 · 8 comments
Labels

Comments

@mmikitka
Copy link

Hello - Is it possible to integrate Enquirer with a browser UI, such that question/prompt definitions and related behaviours are decoupled from the presentation (e.g., CLI, browser)? If so, can you please guide me to the relevant documentation? If not, would you consider adding this to the roadmap?

I am not looking for a terminal-like interface in a browser, rather I'm looking for the core of Enquirer (types of inquiries, validation, etc.) and pluggable outputting functions, so that my app can be used in a terminal environment and a web app environment with minimal code.

I asked a similar question to Inquirer.js, and here is the response: SBoudrias/Inquirer.js#543

@stevenvachon
Copy link

@stevenvachon
Copy link

I think what you'd want to do is not use Enquirer, but create a browser UI library that mocks the same API.

@jonschlinkert
Copy link
Member

I believe @doowb created an example for this with Enquirer 2.0. Maybe we can get him to share how that worked! :)

@amwmedia
Copy link

amwmedia commented Dec 10, 2018

@doowb any chance you have an example of doing this stashed away on your hard-drive somewhere? 😉

@doowb
Copy link
Member

doowb commented Dec 10, 2018

@doowb any chance you have an example of doing this stashed away on your hard-drive somewhere?

Lol... not exactly. I used this carlo example which runs the xterm emulator in the browser.

We have made Enquirer a lot more customizable and decoupled action logic and updates to the state from the rendering and writing to the output stream, so it may be possible to override some methods to make it usable in a browser, but I think it would still require some work.

@jonschlinkert
Copy link
Member

Closing since I think this is something that we could add to the docs or a recipe. A PR is very welcome!

@Kreijstal
Copy link

https://observablehq.com/@kreijstal/xterm-js
made this with a heavily modified version of enquirer :)

@amwmedia
Copy link

have a look at teleterminal too :-) https://github.com/amwmedia/teleterminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants