ant-design-vue/antd-tools/cli/index.js

28 lines
559 B
JavaScript
Raw Normal View History

2018-03-18 11:59:38 +00:00
#!/usr/bin/env node
2019-01-12 03:33:27 +00:00
'use strict';
2018-03-18 11:59:38 +00:00
2019-01-12 03:33:27 +00:00
require('colorful').colorful();
2018-03-18 11:59:38 +00:00
2019-01-12 03:33:27 +00:00
const program = require('commander');
const packageInfo = require('../../package.json');
2018-03-18 11:59:38 +00:00
program
.version(packageInfo.version)
.command('run [name]', 'run specified task')
2019-01-12 03:33:27 +00:00
.parse(process.argv);
2018-03-18 11:59:38 +00:00
// https://github.com/tj/commander.js/pull/260
2019-01-12 03:33:27 +00:00
const proc = program.runningCommand;
2018-03-18 11:59:38 +00:00
if (proc) {
2019-01-12 03:33:27 +00:00
proc.on('close', process.exit.bind(process));
2018-03-18 11:59:38 +00:00
proc.on('error', () => {
2019-01-12 03:33:27 +00:00
process.exit(1);
});
2018-03-18 11:59:38 +00:00
}
2019-01-12 03:33:27 +00:00
const subCmd = program.args[0];
2018-03-18 11:59:38 +00:00
if (!subCmd || subCmd !== 'run') {
2019-01-12 03:33:27 +00:00
program.help();
2018-03-18 11:59:38 +00:00
}