-
Notifications
You must be signed in to change notification settings - Fork 14
/
cli.js
36 lines (30 loc) · 796 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
32
33
34
35
36
#!/usr/bin/env node
'use strict';
var moment = require('moment');
var program = require('commander');
var log = require('./lib/logger');
program.unknownOption = program.help;
program
.usage('[options] <file ...>')
.version(require('./package').version)
.option('-c, --config [config]', 'Specify the location of the configuration file')
.option('-q, --quiet', 'All logging is hidden')
.parse(process.argv);
if(!program.config) {
program.help();
} else {
var wraith = require('./lib/wraith');
var config = require(program.config);
var timer = false;
if(program.quiet) {
config.quiet = true;
} else {
timer = moment();
}
new wraith(config, function() {
if(timer) {
log.info('Time Taken: ' + moment().diff(timer, 'seconds') + 's');
}
log.success('Done');
});
}