2 var path
= require('path');
3 var minimist
= require('minimist');
4 var indentString
= require('indent-string');
5 var objectAssign
= require('object-assign');
6 var camelcaseKeys
= require('camelcase-keys');
8 // needed to get the uncached parent
9 delete require
.cache
[__filename
];
10 var parentDir
= path
.dirname(module
.parent
.filename
);
12 module
.exports = function (opts
, minimistOpts
) {
14 pkg
: './package.json',
15 argv
: process
.argv
.slice(2)
18 var pkg
= require(path
.join(parentDir
, opts
.pkg
));
19 var argv
= minimist(opts
.argv
, minimistOpts
);
20 var help
= '\n' + indentString(pkg
.description
+ (opts
.help
? '\n\n' + opts
.help
: '\n'), ' ');
21 var showHelp = function () {
27 console
.log(pkg
.version
);
40 flags
: camelcaseKeys(argv
),