Skip to content

Commit

Permalink
Improve CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Apr 29, 2023
1 parent bad8d02 commit def9ff5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<filename>')
.name(name)
.description(description)
.version(version)
.argument('<filename>')
.option('--es6-mixed-imports', 'Fetch all dependendies from a file that contains both CJS and ES6 imports')
.option('-t, --type <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');
Expand Down

0 comments on commit def9ff5

Please sign in to comment.