Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 18, 2015
1 parent d7f6d9f commit a9147aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(' 自定义的例子:')
Expand All @@ -363,7 +363,7 @@ program.parse(process.argv);

效果如下:

```
```shell
./bin/wcj.js -h

Usage: wcj [options]
Expand All @@ -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');
Expand Down Expand Up @@ -423,7 +423,7 @@ program.parse(process.argv);

上面实例运行输出方式

```
```shell
$ ./bin/wcj.js resume ss -n aaaaa

#输出:
Expand All @@ -438,7 +438,7 @@ resume "aa" 使用 模式

命名多少个命令就监听多少命令,`--help` 为默认监听事件。

```
```shell
program.on('--help', function(argv,test){
process.exit(1);
});
Expand Down

0 comments on commit a9147aa

Please sign in to comment.