Package Exports
- base-argv
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base-argv) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
base-argv
Plugin that post-processes the argv object from simplify how args are mapped to options, tasks and generators.
Install
Install with npm:
$ npm i base-argv --save
Usage
var Base = require('base-methods');
var tasks = require('base-tasks');
var argv = require('base-argv');
var cli = require('base-cli');
var app = new Base();
// register plugins
app.use(cli());
app.use(tasks());
app.use(argv());
app.task('foo', function() {
// run gulp plugins or something
});
// parse argv
var args = app.argv(['foo', 'bar', '--set=a:b']);
// if `base-cli` plugin is registered too, this
// will automatically map the resulting object to
// application methods
app.cli.process(args);
Results in:
{ set: { a: 'b' }, tasks: [ 'foo', 'bar' ] }
Additionally, the original argv
object and the parsed minimist args are expose on non-enumerable properties, orig
and minimist
respectively.
Example
{ set: { a: 'b' },
tasks: [ 'foo', 'bar' ],
// non-enumerable
minimist: { _: [ 'foo', 'bar' ], set: 'a:b' },
// non-enumerable
orig: [ 'foo', 'bar', '--set=a:b' ] }
Related projects
- base-cli: Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… more | homepage
- base-config: base-methods plugin that adds a
config
method for mapping declarative configuration values to other 'base'… more | homepage - base-methods: base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | homepage
- base-options: Adds a few options methods to base-methods, like
option
,enable
anddisable
. See the readme… more | homepage - base-plugins: Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015-2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 29, 2016.