-
Notifications
You must be signed in to change notification settings - Fork 23
/
sabre.js
executable file
·51 lines (42 loc) · 1.19 KB
/
sabre.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
const env = {
apiKey: process.env.MYTHX_API_KEY,
apiUrl: process.env.MYTHX_API_URL
};
let { apiKey } = env;
if (!apiKey) {
console.log('Unauthenticated use of MythX has been discontinued. Sign up for a account at https://mythx.io/ and set the MYTHX_API_KEY environment variable.');
process.exit(-1);
}
const args = require('minimist')(process.argv.slice(2), {
boolean: [ 'help', 'noCacheLookup', 'debug' ],
string: [ 'mode', 'format' ],
default: { mode: 'quick', format: 'text' },
});
let command = args._[0];
let controller;
switch (command) {
case 'version':
controller = require('./lib/controllers/version');
break;
case 'status':
controller = require('./lib/controllers/status');
break;
case 'list':
controller = require('./lib/controllers/list');
break;
case 'analyze':
controller = require('./lib/controllers/analyze');
break;
case 'check':
controller = require('./lib/controllers/analyze');
args.isCheckProperty = true;
break;
case 'apiVersion':
controller = require('./lib/controllers/api_version');
break;
default:
controller = require('./lib/controllers/help');
break;
}
controller(env, args);