Skip to content
Myr

add zh-CN translation for parseAsync

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oGsLP · committed by John Gee · parent f16fecf · Browse files · 1 file+15 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−1 removed

  • other:+15 added−1 removed

1 file+15 added−1 removed

modified:Readme_zh-CN.md+15 added-1 removed
31 unmodified lines
32 - [自定义事件监听](#%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac)33 - [零碎知识](#%e9%9b%b6%e7%a2%8e%e7%9f%a5%e8%af%86)34 - [避免选项命名冲突](#避免选项命名冲突)35 - [TypeScript](#typescript)36 - [Node 选项例如 `--harmony`](#node-%e9%80%89%e9%a1%b9%e4%be%8b%e5%a6%82---harmony)36 - [Node 选项例如 --harmony](#node-%e9%80%89%e9%a1%b9%e4%be%8b%e5%a6%82---harmony)37 - [Node 调试](#node-%e8%b0%83%e8%af%95)38 - [重载退出(exit)处理](#%e9%87%8d%e8%bd%bd%e9%80%80%e5%87%baexit%e5%a4%84%e7%90%86)39 - [例子](#%e4%be%8b%e5%ad%90)40 - [许可证](#%e8%ae%b8%e5%8f%af%e8%af%81)
330 unmodified lines
371372program.parse(process.argv)373```374375你可以自行实现一个`async`操作处理程序,同时调用`.parseAsync`代替`.parse`。376377```js378async function run() { /* 在这里编写代码 */ }379380async function main() {381 program382 .command('run')383 .action(run);384 await program.parseAsync(process.argv);385}386```387388389当一个命令在命令行上被使用时,它的选项必须是合法的。使用任何未知的选项会报错。然而如果一个基于操作的命令没有定义任何操作,那么这些选项是不合法的。390391定义配置选项可以随着调用 `.command()` 传递。392为 `opts.noHelp` 指定 `true` 则该命令不会出现生成的帮助输出里。
307 unmodified lines