-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.js
executable file
·31 lines (23 loc) · 922 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env node
if (process.argv[2] && process.argv[2] !== 'run') {
console.error('Aborting: No matching ppc command.');
console.error('Did you mean "ppc run <config>"?');
process.exit(1);
}
if (process.argv.length < 3) {
console.error('Aborting: Not enough args.');
console.error('Did you mean "ppc run <config>"?');
process.exit(1);
}
const { Command } = require('commander');
const index = require('./index');
const { version } = require('./package.json');
const cli = new Command();
cli.version(version);
cli.command('run [config]')
.option('-o, --output [output]', 'specify an output format [ <filename>.json | <filename>.md ] - defaults to console output', '')
.description('specify a test config file (defaults to ppc-config.json)')
.action(async (config = 'ppc-config.json', { output }) => {
await index({ config, output });
});
cli.parse(process.argv);