2.0.3 • Published 5 years ago

passed v2.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

passed

npm.io npm.io npm.io npm.io

Install

From NPM:
npm install passed

From GitHub:
npm install xist/passed

Example

const app = passed("my command here --myOption John -myFlag");
// const app = passed(process.argv); <- You can do this too!

app.getCommand(); // my command here
app.getOptions(); // { myOption: "John", myFlag: true }
app.getOption("myOption"); // John
app.getOption("myFlag"); // true

That's it! 😜 You now have access to the passed options.

Extras

You can even handle commands using .on.

app.on("my command here", function(options) {
  // the first .on to match gets called, others get ignored
});

Contribute

Pull requests are encouraged.