-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·40 lines (35 loc) · 933 Bytes
/
cli.js
File metadata and controls
executable file
·40 lines (35 loc) · 933 Bytes
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
32
33
34
35
36
37
38
39
40
#!/usr/bin/env node
var path = require('path');
var argv = require('minimist')(process.argv.slice(2));
if (argv._[0] === 'download') {
var spotcheck = require('./index');
var config = argv._[1];
var date = argv.date;
if (!config) {
return console.error("Missing config.");
}
spotcheck.readConfig(config, date);
spotcheck.run();
} else if (argv._[0] === 'report') {
var report = require('./lib/report');
var filePath = argv._[1];
if (filePath && filePath[0] !== '/') {
filePath = path.join(process.cwd(), filePath);
}
var opts = {
format: argv.format,
field: argv.field
};
if (!filePath) {
return console.error("Missing filePath.");
}
if (!(opts.format || opts.field)) {
return console.error("Missing format or field.");
}
report.report(filePath, opts);
} else {
console.log('OPTIONS');
console.log('=======');
console.log('download');
console.log('report');
}