I was building a CLI for GitHub code search which was using promises pretty heavily as the control flow of the application. It worked well enough in the beginning because the network library was promise based. However I wanted to add a feature where you could query the JSON returned by the GitHub API using json-query. This required that the user enter a REPL-type interaction, where they can enter a command and see the output, rinse and repeat until they have the data they want.
The problem is that all of the I/O in node is non-blocking. This means that all the libraries i looked at to capture user input from the command line were all either prommise based, or used node style
method(data, callback) invocations. This ruled out my first option: using a
while loop inside a promise to repeat the REPL until the user entered 'done'. If I did this I'd end up firing hundreds or thousands of calls to
readline (the library I ended up using) to gather user i