1.0.1 • Published 7 years ago

commander-pojo v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

commander-pojo

transform your parsed commander.js instance into a pojo

Codeship Status for cdaringe/commander-pojo npm.io Coverage Status

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!