commander-pojo

1.0.1 • Public • Published

commander-pojo

transform your parsed commander.js instance into a pojo

Codeship Status for cdaringe/commander-pojo 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!

Package Sidebar

Install

npm i commander-pojo

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • cdaringe