以海盗为主题的现代乐观主义继任者.
<p对齐="中心">
(中文(简体) ). 弧线 Yargs be a Node.js 库 fer hearties trying' ter 剖析选择字符串 (中文(简体) ).< br> (英语)
[!] [NPM版本 [npm-image] [npm-url] (英语). [js-standard-style [标准-图像] [标准-url] [覆盖] [覆盖-图像] [覆盖-url] [常规承诺][常规承诺-形象][常规承诺-url]
□ 说明 Yargs帮助您构建交互式命令行工具,方法是解析参数并生成优雅的用户界面.
它给你:
(原始内容存档于2019-09-29) (英语). ``` mocha [spec..]
Run tests with Mocha
Commands mocha inspect [spec..] Run tests with Mocha [default] mocha init create a client-side Mocha setup at
Rules & Behavior --allow-uncaught Allow uncaught errors to propagate [boolean] --async-only, -A Require all tests to use a callback (async) or return a Promise [boolean]
* 为您的命令生成 Bash 和 Zsh 的完成脚本
* 和[多数] (/docs/api.md)。
□ 安装
稳定版本 :
ZZ1ZZ
具有最新特性的出血边缘版本:
(原始内容存档于2019-09-29). ```bash
npm i yargs@next□ 使用量
简单示例
ZZCODE3 乐团
(原始内容存档于2019-09-26). ```bash $ ./plunder.js --ships=4 --distance=22 Plunder more riffiwobbles!
$ ./plunder.js --ships 12 --distance 98.7 Retreat from the xupptumblers!
> 注:`hideBin'是`process.argv.slicse(2)'的简称。 它的好处在于它考虑到了某些环境中的差异,例如[电 (https://github.com/electron/electron/issues/4690).
复杂示例
``` ZZ
#!/usr/bin/env节点
从“ yargs” 中导入
从“ yargs/ helpers” 导入{ hideBin } ;
亚格( hideBi)pkgConf 会跳过名字中包含句点的目录
帮助文本中的选项列没有足够的分隔
[功能] 我想生成文档
依赖关系仪表板
对选择项进行多次调用不应为同一选项创建重复的选择项
v18.x.x 文档中未提及的包依赖关系
当进程是电子进程的分支子进程时,argv._ 会包含文件路径
隐藏的选项已为 implies 显示
bash 完成:负值布尔选项不自动完成
完成不正确