Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs library / module for developing interactive CLI apps?

been googling for this and searching stackoverflow, but am not coming across anything. I want to develop an interactive shell with node, and wondering on the best approach for this. Is there a library that anyone could recommend to use?

I have written a library, and now want a CLI interface to interact with it, by 2 methods: running the app with parameters, or via interactive shell. e.g.

$ node myapp doSomething
App Result: I did something
$ node myapp cli
Entering interactive mode...
myapp>
myapp> doSomething
App Result: I did something
myapp>

Any suggestions?

like image 507
Brett Avatar asked Oct 17 '12 08:10

Brett


1 Answers

I guess commander.js is what you are looking for.

https://github.com/visionmedia/commander.js

http://oscar-mejia.com/blog/how-to-create-a-command-line-program-with-nodejs/

Also have a look at REPL http://nodejs.org/api/repl.html

like image 89
vinayr Avatar answered Oct 05 '22 06:10

vinayr