-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.js
executable file
·38 lines (30 loc) · 932 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
#!/usr/bin/env node
require('shelljs/global');
var program = require('commander');
var docsFolder = process.cwd() + '/docs';
program.version(require('./package.json').version)
program
.command('clean')
.description('remove the docs folder')
.action(function(env, options){
rm('-rf', docsFolder);
});
program
.command('doc')
.description('prepares the docs folder')
.action(function(env, options){
mkdir('-p', docsFolder);
cp('-r', __dirname + '/lib/swagger-ui/*', docsFolder);
mv('./swagger.json', docsFolder);
});
program
.command('serve [port]')
.description('serves the docs folder')
.action(function(port){
var command = port ?
__dirname + '/node_modules/.bin/http-server --cors -p ' + port :
__dirname + '/node_modules/.bin/http-server --cors'
exec(command);
});
program.parse(process.argv);
if (!program.args || !program.args.length) program.help();