-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·35 lines (31 loc) · 986 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
#!/usr/bin/env node
const yargs = require('yargs');
const shell = require('shelljs');
const fs = require('fs');
const config = require('./config');
if (!fs.existsSync(__dirname + '/' + config.projectPath)) {
shell.mkdir(__dirname + '/' + config.projectPath);
}
yargs.usage('用法: $0 <命令> [选项]')
.command(require('./lib/create'))
.command(require('./lib/build'))
.command(require('./lib/deploy'))
.command(require('./lib/rollback'))
.option('user', {
alias: 'u',
description: '执行操作的用户,默认值为当前登录用户',
type: 'string'
})
.option('help', {
alias: 'h',
description: '显示帮助信息'
})
.demandCommand(1, '请输入有效的命令')
.help('help')
.version('version', '显示版本信息', require(__dirname + '/package.json').version)
.alias('version', 'v')
// show examples of application in action.
.example('$0 build demo_project', '构建项目')
.strict()
.locale('zh_CN')
.argv;