Prepare for 5.0.0 (#1211)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Update version and CHANGELOG for 5.0.0 * Update require style * Set approximate release date
authored by John Gee · committed by GitHub · parent f14df07 · Browse files · 4 files·+46 added−51 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+46 added−51 removed
- other:+46 added−51 removed
Provenance
- Commit
83af0fd- Tree
e173879- Author
John Gee <john@ruru.gen.nz>- Committer
GitHub <noreply@github.com>- Parent
f14df07
4 files changed+46 added−51 removed
modified:CHANGELOG.md+36 added-41 removed
5 unmodified lines6 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.)7 8 <!-- markdownlint-disable MD024 -->9 10-## [5.0.0-4] (2020-03-03)10+## [5.0.0] (2020-03-14)11 12 ### Added13 14-* `createCommand` factory method to simplify subclassing ([#1191])15-16-## [5.0.0-3] (2020-02-20)17-18-### Added19-20-* TypeScript definition for `commands` property of `Command` ([#1184])21-* export `program` property ([#1195])22-23-## [5.0.0-2] (2020-02-10)24-25-### Added26-27-* suggest help option along with unknown command error ([#1179])28-29-### Changed30-31-* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])32-* `.parseAsync` returns `Promise<this>` to be consistent with `.parse()` ([#1180])33-34-## [5.0.0-1] (2020-02-08)35-36-### Added37-38-* `.helpInformation()` returns help text as a string, previously a private routine ([#1169])39-* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172])40-* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172])41-42-### Changed43-44-* changes to error handling ([#1165])45- * throw for author error, not just display message46- * preflight for variadic error47- * add tips to missing subcommand executable48-* update dependencies49-50-## [5.0.0-0] (2020-02-02)51-52-### Added53-14 * support for nested commands with action-handlers ([#1] [#764] [#1149])15 * `.addCommand()` for adding a separately configured command ([#764] [#1149])16 * allow a non-executable to be set as the default command ([#742] [#1149])17 * implicit help command when there are subcommands (previously only if executables) ([#1149])1 unmodified line19 * display error message for unknown subcommand, by default ([#432] [#1088] [#1149])20 * display help for missing subcommand, by default ([#1088] [#1149])21 * combined short options as single argument may include boolean flags and value flag and value (e.g. `-a -b -p 80` can be written as `-abp80`) ([#1145])22 * `.parseOption()` includes short flag and long flag expansions ([#1145])23+* `.helpInformation()` returns help text as a string, previously a private routine ([#1169])24+* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172])25+* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172])26+* suggest help option along with unknown command error ([#1179])27+* TypeScript definition for `commands` property of `Command` ([#1184])28+* export `program` property ([#1195])29+* `createCommand` factory method to simplify subclassing ([#1191])30 31 ### Fixed32 33 * preserve argument order in subcommands ([#508] [#962] [#1138])18 unmodified lines52 * `unknown` in returned result has arguments after first unknown option including operands, not just options and values53 * *Breaking* `.on('command:*', callback)` and other command events passed (changed) results from `.parseOptions`, i.e. operands and unknown ([#1138])54 * refactor Option from prototype to class ([#1133])55 * refactor Command from prototype to class ([#1159])56+* changes to error handling ([#1165])57+ * throw for author error, not just display message58+ * preflight for variadic error59+ * add tips to missing subcommand executable60+* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])61+* `.parseAsync` returns `Promise<this>` to be consistent with `.parse()` ([#1180])62+* update dependencies63 64 ### Removed65 66 * removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on `@types/node` ([#1146])7 unmodified lines74 If you use `program.args` or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour.75 76 If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command.77 78+## [5.0.0-4] (2020-03-03)79+80+(Released in 5.0.0)81+82+## [5.0.0-3] (2020-02-20)83+84+(Released in 5.0.0)85+86+## [5.0.0-2] (2020-02-10)87+88+(Released in 5.0.0)89+90+## [5.0.0-1] (2020-02-08)91+92+(Released in 5.0.0)93+94+## [5.0.0-0] (2020-02-02)95+96+(Released in 5.0.0)97+98 ## [4.1.1] (2020-02-02)99 100 ### Fixed101 234 unmodified lines336 [#1191]: https://github.com/tj/commander.js/pull/1191337 [#1195]: https://github.com/tj/commander.js/pull/1195338 339 [Unreleased]: https://github.com/tj/commander.js/compare/master...develop340+[5.0.0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0341 [5.0.0-4]: https://github.com/tj/commander.js/compare/v5.0.0-3..v5.0.0-4342 [5.0.0-3]: https://github.com/tj/commander.js/compare/v5.0.0-2..v5.0.0-3343 [5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2344 [5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-111 unmodified linesmodified:package-lock.json+1 added-1 removed
1 {2 "name": "commander",3- "version": "5.0.0-4",3+ "version": "5.0.0",4 "lockfileVersion": 1,5 "requires": true,6 "dependencies": {7 "@babel/code-frame": {6126 unmodified linesmodified:package.json+1 added-1 removed
1233456737 unmodified lines{ "name": "commander", "version": "5.0.0-4", "version": "5.0.0", "description": "the complete solution for node.js command-line programs", "keywords": [ "commander", "command",37 unmodified linesmodified:Readme_zh-CN.md+8 added-8 removed
9 unmodified lines10 用其他语言阅读:[English](./Readme.md) | 简体中文11 12 - [Commander.js](#commanderjs)13 - [安装](#%e5%ae%89%e8%a3%85)14- - [声明_program_变量](#%e5%a3%b0%e6%98%8eprogram%e5%8f%98%e9%87%8f)14+ - [声明program变量](#%e5%a3%b0%e6%98%8eprogram%e5%8f%98%e9%87%8f)15 - [选项](#%e9%80%89%e9%a1%b9)16 - [常用选项类型,boolean和值](#%e5%b8%b8%e7%94%a8%e9%80%89%e9%a1%b9%e7%b1%bb%e5%9e%8bboolean%e5%92%8c%e5%80%bc)17 - [默认选项值](#%e9%bb%98%e8%ae%a4%e9%80%89%e9%a1%b9%e5%80%bc)18 - [其他选项类型,可忽略的布尔值和标志值](#%e5%85%b6%e4%bb%96%e9%80%89%e9%a1%b9%e7%b1%bb%e5%9e%8b%e5%8f%af%e5%bf%bd%e7%95%a5%e7%9a%84%e5%b8%83%e5%b0%94%e5%80%bc%e5%92%8c%e6%a0%87%e5%bf%97%e5%80%bc)2 unmodified lines21 - [版本选项](#%e7%89%88%e6%9c%ac%e9%80%89%e9%a1%b9)22 - [Commands](#commands)23 - [指定参数语法](#%e6%8c%87%e5%ae%9a%e5%8f%82%e6%95%b0%e8%af%ad%e6%b3%95)24 - [操作处理程序(Action handler) (子)命令](#%e6%93%8d%e4%bd%9c%e5%a4%84%e7%90%86%e7%a8%8b%e5%ba%8faction-handler-%e5%ad%90%e5%91%bd%e4%bb%a4)25- - [独立的可执行子命令](#%e7%8b%ac%e7%ab%8b%e7%9a%84%e5%8f%af%e6%89%a7%e8%a1%8c%e5%ad%90%e5%91%bd%e4%bb%a4)25+ - [独立的可执行(子)命令](#%e7%8b%ac%e7%ab%8b%e7%9a%84%e5%8f%af%e6%89%a7%e8%a1%8c%e5%ad%90%e5%91%bd%e4%bb%a4)26 - [自动化帮助信息 help](#%e8%87%aa%e5%8a%a8%e5%8c%96%e5%b8%ae%e5%8a%a9%e4%bf%a1%e6%81%af-help)27 - [自定义帮助](#%e8%87%aa%e5%ae%9a%e4%b9%89%e5%b8%ae%e5%8a%a9)28 - [.usage 和 .name](#usage-%e5%92%8c-name)29 - [.help(cb)](#helpcb)2 unmodified lines32 - [.helpOption(flags, description)](#helpoptionflags-description)33 - [.addHelpCommand()](#addhelpcommand)34 - [自定义事件监听](#%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac)35 - [零碎知识](#%e9%9b%b6%e7%a2%8e%e7%9f%a5%e8%af%86)36- - [.parse() and .parseAsync()](#parse-%e5%92%8c-parseasync)36+ - [.parse() 和 .parseAsync()](#parse-%e5%92%8c-parseasync)37 - [避免选项命名冲突](#%e9%81%bf%e5%85%8d%e9%80%89%e9%a1%b9%e5%91%bd%e5%90%8d%e5%86%b2%e7%aa%81)38 - [TypeScript](#typescript)39 - [Node 选项例如 `--harmony`](#node-%e9%80%89%e9%a1%b9%e4%be%8b%e5%a6%82---harmony)40- - [Debugging stand-alone executable subcommands](#%e8%b0%83%e8%af%95%e7%8b%ac%e7%ab%8b%e5%8f%af%e6%89%a7%e8%a1%8c%e5%ad%90%e5%91%bd%e4%bb%a4)40+ - [调试独立可执行子命令](#%e8%b0%83%e8%af%95%e7%8b%ac%e7%ab%8b%e5%8f%af%e6%89%a7%e8%a1%8c%e5%ad%90%e5%91%bd%e4%bb%a4)41 - [重载退出(exit)处理](#%e9%87%8d%e8%bd%bd%e9%80%80%e5%87%baexit%e5%a4%84%e7%90%86)42 - [例子](#%e4%be%8b%e5%ad%90)43 - [许可证](#%e8%ae%b8%e5%8f%af%e8%af%81)44 - [支持](#%e6%94%af%e6%8c%81)9 unmodified lines54 55 Commander为了方便快速编程导出了一个全局对象。为简洁起见,本README中的示例中使用了它。56 57 ```js58-const program = require('commander');58+const { program } = require('commander');59 program.version('0.0.1');60 ```61 62 对于可能以多种方式使用commander的大型程序,包括单元测试,最好创建一个本地Command对象来使用。63 64 ```js65-const commander = require('commander');66-const program = new commander.Command();65+const { Command } = require('commander');66+const program = new Command();67 program.version('0.0.1');68 ```69 70 ## 选项15 unmodified lines86 87 最常用的两个选项类型是boolean(选项后面不跟值)和选项跟一个值(使用尖括号声明)。除非在命令行中指定,否则两者都是`undefined`。88 89 ```js90-const program = require('commander');90+const { program } = require('commander');91 92 program93 .option('-d, --debug', 'output extra debugging')94 .option('-s, --small', 'small pizza size')616 unmodified lines