diff --git a/bin/cli.js b/bin/cli.js index 6f0bedc..6e300df 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -5,21 +5,24 @@ const fs = require('fs'); const program = require('commander'); const precinct = require('../index.js'); -const { version } = require('../package.json'); +const { name, description, version } = require('../package.json'); program - .arguments('') + .name(name) + .description(description) .version(version) + .argument('', 'the path to file to examine') .option('--es6-mixed-imports', 'Fetch all dependendies from a file that contains both CJS and ES6 imports') .option('-t, --type ', 'The type of content being passed in. Useful if you want to use a non-JS detective') + .showHelpAfterError() .parse(); -const cliOptions = program.opts(); +const { es6MixedImports: mixedImports, type } = program.opts(); const options = { es6: { - mixedImports: Boolean(cliOptions.es6MixedImports) + mixedImports: Boolean(mixedImports) }, - type: cliOptions.type + type }; const content = fs.readFileSync(program.args[0], 'utf8');