passed
v2.0.3
Published
command line argument parser
Downloads
8
Maintainers
Readme
passed
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.