Node.js – making a CLI module that returns a promise

All the enjoyable coding I do these days is JavaScript – especially Node.js. I just figured out a nice way to make your module CLI / bash / shell friendly as well as of course, making it available for use as a module.

Without further ado, here’s the code I came up with:

I plan to publish this on NPM soonish once I get a breather.

[UPDATE] The module is published here: https://www.npmjs.com/package/github-related-emails

But there are 2 ways to use this:

nodejs index.js --user [username]

or

Another cool thing is that it returns a promise. Loving ES6 native promises these days.

Have fun!

Write a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.