Interactive Command Line User Interfaces In Node
The Command npm init, ask a series of questions and gets those answer and write it in a file? How can I create a similar command line utility in node? Is there any packages availab
Solution 1:
The inquirier package should meet your needs. Have a look at the examples they provide here on github
Solution 2:
Vorpal.js is built on top of Inquirer.js, and provides an interactive CLI, with an easy API for adding commands, which seems to be what you are looking for.
Implementing is easy:
var vorpal = require('vorpal')();
vorpal
.delimiter('myapp$')
.show();
vorpal
.command('foo', 'Logs "bar".')
.action(function(args, cb){
this.log('bar');
cb();
});
Your app is now interactive:
$ node app.js
myapp$ foo
bar
myapp$
Disclaimer: I wrote Vorpal, so if you have questions, ask away.
Post a Comment for "Interactive Command Line User Interfaces In Node"