0.0.3 • Published 9 years ago
ode v0.0.3
Ode
Zero overhead CLI adapter for Node modules.
// greeter.js
module.exports = function (options) {
console.log("Howdy, " + options.name + "!");
console.log(options.number * options.factor);
if (options.verbose === true) {
console.log("Features: Numbers are casted to numbers\n" +
"unassigned flags are casted to `true` values\n" +
"otherwise the value is taken as string");
}
}
ode greeter --name=Johnny --number=2 --factor=4 --verbose
It can also be used programmatically to make CLIs out of your modules:
var Ode = require("ode");
var yourModule = require("your-module");
Ode(process.argv, function (options) {
yourModule(options);
});
Installation
npm install -g ode
CoffeeScript
Because it is so widespread, Ode comes with support for CoffeeScript out of the box. If you want to use another dialect/transpiler, please pull request.
Testing
Clone this repo and run
npm test
License
Copyright 2014 Xavier Via
ISC license.
See LICENSE attached.