Skip to content

evocateur/butterscotch-pudding

Repository files navigation

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

About

Create figgy-pudding instances with yargs options config

Resources

License

Stars

Watchers

Forks

Packages

No packages published