5 ms·
Commander.js – Node.js command-line interfaces made easy
- phpnode 12y agosee also yargs - https://github.com/chevex/yargs https://github.com/chevex/yargs
- jdc0589 12y agoCommander 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/index.js#L37 https://github.com/jdc0589/mite-node/blob/master/lib/cli/ind...)
- niftylettuce 12y agoAlso see <https://github.com/sindresorhus/chalk> https://github.com/sindresorhus/chalk>
- jdc0589 12y agochalk 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.
- arthurschreiber 12y agoI really like docopt (http://docopt.org/ http://docopt.org/) which also comes as a CoffeeScript / JavaScript version.
- Killswitch 12y agoCommander is great. Anything by TJ Holowaychuk is worth using in any Node.js project. Dude is legit.
- patrickg 12y agoAnother shameless plug: https://github.com/pgundlach/argumentr https://github.com/pgundlach/argumentr
- tjholowaychuk 12y agowtf haha this is SUPER old. FWIW I also really like the docopt approach, really cool
- deleted 12y ago[deleted]
- arrowgunz 12y agooh hackernews! you guys downvote the author of the program that's being discussed. facepalm
- Volscio 12y agoSomewhat 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?
- cmpb 12y agoAn old coworker of mine wrote this: https://github.com/doughsay/room.js https://github.com/doughsay/room.js Might that be what you're looking for?
- hath995 12y agohttps://github.com/shawncplus/ranviermud 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.
- Volscio 12y agoAh hah, I'd known about ranviermud but hadn't noticed it had a telnet lib! Will give it a look-see, thank you!!
- tlrobinson 12y agoAs far as I'm concerned, docopt (on HN yesterday: https://news.ycombinator.com/item?id=7830559 https://news.ycombinator.com/item?id=7830559 ) obsoletes all other command line parsing libraries. Yes, there is a Node.js implementation.
- abritishguy 12y agoArmin 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 https://github.com/sboudrias/inquirer.js) that a very good at doing the other stuff.
- vezzy-fnord 12y agoI don't think the name is too apt, considering "commander" at this point refers to a heritage of file managers with distinctive UIs.
- secoif 12y agoCommander.js is a few years old and adopts the name from a ruby project of the same name (from same author) from 09.
- abritishguy 12y agoinquirer.js (https://github.com/sboudrias/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.
- antonapa 12y agoAt the risk of being ridiculed, how would one go about to just take a variable without flag? Ie specialhttpcliutiltool http://yoururl.com http://yoururl.com?
- nielsbjerg 12y agoThat 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 http://nodejs.org/api/process.html#process_process_argv