-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcli.js
40 lines (32 loc) · 961 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
37
38
39
#!/usr/bin/env node
var program = require('commander');
var helper = require('./helper');
program
.version('0.1.0')
.usage('kc [command] <options>')
program
.command('init')
.description('creates an empty server')
.action(helper.executeInit);
program
.command('controller <name>')
.description('creates a empty [name] controller')
.action((name) => {
helper.executeController(name);
});
program
.command('middleware <name>')
.option("-t, --type <type>", "Please specify the type <before|after>")
.description('creates a empty middleware')
.action((name, options) => {
helper.executeMiddleware(name, options.type);
});
program
.command('build')
.option("-e, --env <env>", "Please specify the environment")
.option("-w, --watch", "Watch for changes in source code")
.description('Build your code')
.action((options) => {
helper.executeBuild(options.env, options.watch);
});
program.parse(process.argv);