-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (38 loc) · 860 Bytes
/
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
const minimist = require('minimist')
const error = require('./utils/error')
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 'init':
require('./cmds/init')(args)
break
case 'config':
require('./cmds/config')(args)
break
case 'resize':
require('./cmds/resize')(args)
break
case 'slide':
require('./cmds/slide')(args)
break
case 'static':
require('./cmds/static')(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
}
}