-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
69 lines (55 loc) · 1.42 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// @vendors
const minimist = require('minimist');
// @utils
const error = require('./utils/error');
// @root
var path = require('path');
global.appRoot = path.resolve();
// @config
try {
require(appRoot + '/bb-pr-config.json');
} catch (err) {
error(`"bb-pr-config.json" file not found!`, true);
}
module.exports = () => {
const args = minimist(process.argv.slice(2));
let cmd = args._[0] || 'help';
if (args.version || args.v) {
cmd = 'version';
}
if (args.help || args.h) {
cmd = 'help';
}
switch (cmd) {
case 'full':
require('./cmds/full')(args);
break;
case 'pr':
require('./cmds/request')(args);
break;
case 'forks':
require('./cmds/forks')(args);
break;
case 'slack':
require('./cmds/slack')(args);
break;
case 'tag':
require('./cmds/tag')(args);
break;
case 'version-update':
require('./cmds/version-update')(args);
break;
case 'lib-update':
require('./cmds/lib-update')(args);
break;
case 'version':
require('./cmds/version')(args);
break;
case 'help':
require('./cmds/help')(args);
break;
default:
error(`"${cmd}" is not a valid command!`, true);
break;
}
};