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

Break out of the terminal – an architecture suggestion #463

Closed
stefanbuck opened this issue Nov 25, 2016 · 4 comments
Closed

Break out of the terminal – an architecture suggestion #463

stefanbuck opened this issue Nov 25, 2016 · 4 comments

Comments

@stefanbuck
Copy link

Recently I was working on an internal project for my company. It's a simple CLI tool and of course I used Inquirer.js. Everything works pretty well so far. There is only one thing which is bothering me. The user needs to have Node.JS installed and must know some basic terminal commands in order to install and use the program.

To open up the tool to a broader group I was first considering to build something similar to https://github.com/yeoman/yeoman-app. Since I'm already stuck with getting the yeoman project forward I was looking for a generic solution where everyone like the yeoman-app project can benefit.

In yeoman/environment you implemented something that you call adapter which is basicly a wrapper around Inquirer.js. My idea is to build something similar into Inquierer.js so we can easily overwrite the render function of each component. I did a quick exploration by overloading inquirer/lib/prompts/list.js and it works pretty well. This is the gist with the example code https://gist.github.com/stefanbuck/3668ee97aba0cfa859203704be7041a6

Another option would be to write a package with implements exactly the same interface as Inquirer.js has. Of course this has a couple down sides, mainly the biggest on is that maintaining one project is hard, maintaining two dependent project is even harder.

I would love to hear what do you think about the idea in general. Do you think it's worth to spend time on it?

@SBoudrias
Copy link
Owner

You can use https://github.com/SBoudrias/Inquirer.js#inquirerregisterpromptname-prompt to overwrite the existing prompts. Would you need anything more?

@sebilasse
Copy link

@stefanbuck You can have a look at https://github.com/KamiKillertO/inquirer-select-directory for an example regarding https://github.com/SBoudrias/Inquirer.js#inquirerregisterpromptname-prompt ...

@stefanbuck
Copy link
Author

I'll check out your repo. Thanks for sharing.

@stefanbuck
Copy link
Author

I didn't have time to take a closer look. Will do it over christmas and comment here in case this is not what I want to do 😉

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

3 participants