1.0.1 • Published 8 years ago
commander-pojo v1.0.1
commander-pojo
transform your parsed commander.js instance into a pojo
install
npm install --save commander-pojo
usage
suppose you run the following: some-bin --test-flag test-cmd
// some-bin
#!/usr/bin/env node
var cpojo = require('commander-pojo')
var program = require('commander')
program
.option('--test-flag', 'dummy flag')
.arguments('<test-cmd> [test-arg]')
.action(function (cmd, arg) { /* ... */ })
.option('--test-sub-flag', 'sub flag')
.parse(process.argv)
console.log(program) // <== `program instanceof Commander`, loads of _privateCommanderStuff, +more
console.log(cpojo(program)) // <== { testFlag: true }. simple pojo!