Plugin for @opt/parse adding type def which calls require() on the value.
It adds to nopt's
typeDef a new type marked by the string
require. When an option has that type it is tested as a path first, then,
require() is called on it to get the result, which is placed into the parsed options.
Basically, you can do an option like:
name: require and
name: [require, Array] and you'll get back the result of the require operation in the
npm install @opt/require --save
var parse =// make nopt the parser and apply our require pluginparsevar options =// the type def is marked with string 'require()'// this allows multiple of them, set into an array.plugin: require Array// an example args array with a plugin option to require()// the module path must be absolute, or relative to CWD. or use ~/var argv = 'node' 'some.js' '--plugin' 'some/module'// then use parse as you would use `nopt`,// plus any changes made possible by the plugins addedoptions =// the above would produce:options =// can't write a function... so, 'theModuleFunction' means a real function// returned by require('some/module')plugin: theModuleFunctionargv:original: 'node' 'some.js' '--plugin' 'some/module'original: 'node' 'some.js' '--plugin' 'some/module'remain :