-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
25 lines (23 loc) · 803 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
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var program = require('commander');
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json')));
var generation = require('./lib/generation');
program.version(pkg.version)
.option('start', 'Start application')
.option('init', 'Init a new application')
.option('endpoint', 'Create an API endpoint for models')
.option('model', 'Create a model').parse(process.argv);
if (program.start) {
console.log('Starting app');
require('./index.js')();
} else if (program.init) {
generation.init_project();
} else if (program.endpoint) {
generation.create_endpoint();
} else if (program.model) {
generation.create_model();
} else if (program.controller) {
generation.create_controller();
}