-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
33 lines (30 loc) · 862 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
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var dfog = new (require('./'));
var fs = require('fs');
var cli = require('cli').enable("status", "help", "version");
cli.setApp("dfog", "0.0.0");
cli.parse({
wait: ['w', 'Time to wait on post load actions in browser', 'number', 0]
});
cli.main(function(args, options) {
cli.debug(JSON.stringify(args));
cli.debug(JSON.stringify(options));
if(args[0] != null){
fs.exists(args[0], function(exists) {
if (exists) {
dfog.run(args[0], function(err, res){
if(err != null) cli.error(err);
console.log(res);
});
}
else{
cli.fatal("Input file does not exist.");
}
});
}
else{
cli.info("dfog code normalizer");
}
});