0.4.1 • Published 8 years ago

minimist-expand v0.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

minimist-expand NPM version Build Status

Expand minimist args with expand-object.

Install

Install with npm:

$ npm install minimist-expand --save

Without minimist-expand

$ --set=a:b,c,d
# results in => { _: [], set: 'a:b,d,d' }

With minimist-expand

$ --set=a:b
# results in => { _: [], set: {a: ['b', 'c', 'd']}}

Usage

Install minimist-plugins:

$ npm i minimist-plugins --save

Then add minimist-expand as a plugin:

var minimist = require('minimist');
var plugins = require('minimist-plugins');

var cli = plugins(mimimist)
  .use(require('minimist-expand'));

// '$ --set=a:b'
cli.parse(process.argv.slice(2), function (err, res) {
  //=> {_: [], set: {a: 'b'}}
});

Events

When used with minimist-events, call this plugin first so that events are emitted for all keys in the resulting object:

var minimist = require('minimist');
var plugins = require('minimist-plugins');

var cli = plugins(mimimist)
  .use(require('minimist-expand'))
  .use(require('minimist-events')());

cli.on('set', function (val) {
  console.log('set =>', val);
  //=> {a: 'b'}
});

// '$ --set=a:b'
cli.parse(process.argv.slice(2), function (err, res) {
  //=> {_: [], set: {a: 'b'}}
});

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on February 25, 2016.