butterscotch-pudding

2.0.0 • Public • Published

butterscotch-pudding version travis

Create figgy-pudding instances from yargs options

One day, long ago, it was Talk Like A Pirate Day and Butterscotch Pudding Day.

pudding

Install

$ npm install butterscotch-pudding

Usage

const bp = require('butterscotch-pudding');
const yargs = require('yargs/yargs');
 
const opts = {
    ships: {
        type: 'number',
        default: 3,
    },
    distance: {
        type: 'number',
    },
    color: {
        type: 'string',
        defaultDescription: 'butterscotch',
    },
};
 
const CommandOptions = bp(opts);
const argv = yargs().options(opts).parse('--distance 100 --color chartreuse --cutlass');
const opts = CommandOptions(argv);
 
opts.get('ships'); // => 3
opts.get('color'); // => 'chartreuse'
opts.get('cutlass'); // => Error: CommandOptions does not define 'cutlass'

API

Package Sidebar

Install

npm i butterscotch-pudding

Weekly Downloads

0

Version

2.0.0

License

ISC

Unpacked Size

5.6 kB

Total Files

5

Last publish

Collaborators

  • evocateur