Commander.js – Node.js command-line interfaces made easy(github.com)
github.com
Commander.js – Node.js command-line interfaces made easy
https://github.com/visionmedia/commander.js
12 comments
Armin Ronacher explained why he made click and particular cases where docopt was too limited (although he said for cases where docopt works then it is very good).
Also docopt only does command line parsing, that is only a very small part of a command line interface and there are lots of libraries like inquirer (https://github.com/sboudrias/inquirer.js) that a very good at doing the other stuff.
Also docopt only does command line parsing, that is only a very small part of a command line interface and there are lots of libraries like inquirer (https://github.com/sboudrias/inquirer.js) that a very good at doing the other stuff.
I really like docopt (http://docopt.org/) which also comes as a CoffeeScript / JavaScript version.
Somewhat related, but I've been looking for a node.js-based module for providing a telnet/MUD CLI but either it's implemented through a web page with an input box, or has only the basic telnet protocol fleshed out with no user interaction. Any ideas?
https://github.com/shawncplus/ranviermud Its a super basic MUD written in Node. It has some telnet libraries you might want to take a look at.
Ah hah, I'd known about ranviermud but hadn't noticed it had a telnet lib! Will give it a look-see, thank you!!
An old coworker of mine wrote this: https://github.com/doughsay/room.js
Might that be what you're looking for?
Might that be what you're looking for?
inquirer.js (https://github.com/sboudrias/inquirer.js) is very good for asking the user questions and getting input e.g.
- checkboxes
- lists
- confirms
- text input
etc.
etc.
Commander has been around for a good while now, and is a pretty solid library. I really appreciate how easy it makes writing git style subcommands with good isolation of options/flags between the entry-point command vs subcommands.
example of a subcommand heavy CLI using commander: [mite-node](https://github.com/jdc0589/mite-node/blob/master/lib/cli/ind...)
example of a subcommand heavy CLI using commander: [mite-node](https://github.com/jdc0589/mite-node/blob/master/lib/cli/ind...)
Commander is great. Anything by TJ Holowaychuk is worth using in any Node.js project. Dude is legit.
At the risk of being ridiculed, how would one go about to just take a variable without flag? Ie specialhttpcliutiltool http://yoururl.com?
That is done by: process.argv.slice(2)[0]
The first two arguments are node, and the name of the file you are running.
More here: http://nodejs.org/api/process.html#process_process_argv
Another shameless plug: https://github.com/pgundlach/argumentr
I don't think the name is too apt, considering "commander" at this point refers to a heritage of file managers with distinctive UIs.
Commander.js is a few years old and adopts the name from a ruby project of the same name (from same author) from 09.
Also see <https://github.com/sindresorhus/chalk>
chalk is only tangentially related, but it is great. Switching my reporting/output layer from color to chalk took about 5 minutes. Chalk is a much better library.
see also yargs - https://github.com/chevex/yargs
wtf haha this is SUPER old. FWIW I also really like the docopt approach, really cool
[deleted]
oh hackernews! you guys downvote the author of the program that's being discussed. facepalm
Yes, there is a Node.js implementation.