From a9147aa6262919821fe3b6328984df3997b881e6 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Fri, 19 Jun 2015 03:05:09 +0800 Subject: [PATCH] update README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd57101..f09b963 100644 --- a/README.md +++ b/README.md @@ -348,7 +348,7 @@ Commander会根据配置的option,sub-command等信息,自动生成help信 可以通过监听--help事件来输出额外的帮助信息,如下面给fe命令添加了一些examples -``` +```js // must be before .parse() since node's emit() is immediate program.on('--help', function () { console.log(' 自定义的例子:') @@ -363,7 +363,7 @@ program.parse(process.argv); 效果如下: -``` +```shell ./bin/wcj.js -h Usage: wcj [options] @@ -385,7 +385,7 @@ program.parse(process.argv); [列子源码](https://github.com/jaywcjlove/wcj/blob/master/examples/gitstyle.js) -``` +```js #!/usr/bin/env node var program = require('commander'); var appInfo = require('./../package.json'); @@ -423,7 +423,7 @@ program.parse(process.argv); 上面实例运行输出方式 -``` +```shell $ ./bin/wcj.js resume ss -n aaaaa #输出: @@ -438,7 +438,7 @@ resume "aa" 使用 模式 命名多少个命令就监听多少命令,`--help` 为默认监听事件。 -``` +```shell program.on('--help', function(argv,test){ process.exit(1); });