Skip to content

Commit

Permalink
feat: support -v and --version command.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpselvis committed Aug 17, 2017
1 parent 64e76c8 commit fa14d9e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
5 changes: 4 additions & 1 deletion lib/feflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ function entry(args) {
return feflow.init().then(function() {
let cmd = '';

if (!args.h && !args.help) {
if (args.v || args.version) {
console.log(`v${feflow.version}`);
return;
} else if (!args.h && !args.help) {
cmd = args._.shift();

if (cmd) {
Expand Down
11 changes: 4 additions & 7 deletions lib/plugins/console/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ function helpConsole(args) {
Usage: feflow [options] [command]
Commands:
init Choose a scaffold to initialize project.
init Choose a boilerplate to initialize project.
install <plugin> Install a plugin or a yeoman generator.
publish Publish files to cdn or offline package.
jb Publish to jb when in development.
ars --env Publish to ars code platform, env is daily, pre or prod.
Options:
--version, -[vV] Print version and exit successfully.
--help, -[hH] Print this help and exit successfully.
--version, -[v] Print version and exit successfully.
--help, -[h] Print this help and exit successfully.
Report bugs to http://git.code.oa.com/feflow/discussion/issues.
Report bugs to https://github.com/iv-web/feflow-cli/issues.
`);

return cli.showHelp(1);
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function init(ctx) {
name && run(name, ctx);
});
} else {
log.warn('检测到你还未安装任何脚手架,请先安装后再进行项目初始化,参考文档:http://feflow.oa.com/docs/index.html')
log.warn('检测到你还未安装任何模板,请先安装后再进行项目初始化,参考文档:https://github.com/iv-web/feflow-cli/blob/master/README.md')
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = function(ctx) {

const cmd = ctx.cmd;

cmd.register('init', 'Choose a scaffold to initialize project.', {}, require('./generator'));
cmd.register('init', 'Choose a boilerplate to initialize project.', {}, require('./generator'));
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"bunyan": "^1.8.12",
"chalk": "^2.0.1",
"co": "^4.6.0",
"easy-table": "^1.1.0",
"figlet": "^1.2.0",
"hexo-fs": "^0.2.1",
"inquirer": "^3.0.6",
Expand Down

0 comments on commit fa14d9e

Please sign in to comment.