File tree 1 file changed +5
-5
lines changed 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ Commander会根据配置的option,sub-command等信息,自动生成help信
348
348
349
349
可以通过监听--help事件来输出额外的帮助信息,如下面给fe命令添加了一些examples
350
350
351
- ```
351
+ ``` js
352
352
// must be before .parse() since node's emit() is immediate
353
353
program .on (' --help' , function () {
354
354
console .log (' 自定义的例子:' )
@@ -363,7 +363,7 @@ program.parse(process.argv);
363
363
364
364
效果如下:
365
365
366
- ```
366
+ ``` shell
367
367
./bin/wcj.js -h
368
368
369
369
Usage: wcj [options]
@@ -385,7 +385,7 @@ program.parse(process.argv);
385
385
386
386
[ 列子源码] ( https://github.com/jaywcjlove/wcj/blob/master/examples/gitstyle.js )
387
387
388
- ```
388
+ ``` js
389
389
#! / usr/ bin/ env node
390
390
var program = require (' commander' );
391
391
var appInfo = require (' ./../package.json' );
@@ -423,7 +423,7 @@ program.parse(process.argv);
423
423
424
424
上面实例运行输出方式
425
425
426
- ```
426
+ ``` shell
427
427
$ ./bin/wcj.js resume ss -n aaaaa
428
428
429
429
# 输出:
@@ -438,7 +438,7 @@ resume "aa" 使用 模式
438
438
439
439
命名多少个命令就监听多少命令,` --help ` 为默认监听事件。
440
440
441
- ```
441
+ ``` shell
442
442
program.on(' --help' , function(argv,test){
443
443
process.exit(1);
444
444
});
You can’t perform that action at this time.
0 commit comments