UNPKG

15.1 kBMarkdownView Raw
1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6and 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<!-- markdownlint-disable MD004 -->
10
11## [6.2.0] (2020-10-25)
12
13### Added
14
15- added 'tsx' file extension for stand-alone executable subcommands ([#1368])
16- documented second parameter to `.description()` to describe command arguments ([#1353])
17- documentation of special cases with options taking varying numbers of option-arguments ([#1332])
18- documentation for terminology ([#1361])
19
20### Fixed
21
22- add missing TypeScript definition for `.addHelpCommand()' ([#1375])
23- removed blank line after "Arguments:" in help, to match "Options:" and "Commands:" ([#1360])
24
25### Changed
26
27- update dependencies
28
29## [6.1.0] (2020-08-28)
30
31### Added
32
33- include URL to relevant section of README for error for potential conflict between Command properties and option values ([#1306])
34- `.combineFlagAndOptionalValue(false)` to ease upgrade path from older versions of Commander ([#1326])
35- allow disabling the built-in help option using `.helpOption(false)` ([#1325])
36- allow just some arguments in `argumentDescription` to `.description()` ([#1323])
37
38### Changed
39
40- tidy async test and remove lint override ([#1312])
41
42### Fixed
43
44- executable subcommand launching when script path not known ([#1322])
45
46## [6.0.0] (2020-07-21)
47
48### Added
49
50- add support for variadic options ([#1250])
51- allow options to be added with just a short flag ([#1256])
52 - *Breaking* the option property has same case as flag. e.g. flag `-n` accessed as `opts().n` (previously uppercase)
53- *Breaking* throw an error if there might be a clash between option name and a Command property, with advice on how to resolve ([#1275])
54
55### Fixed
56
57- Options which contain -no- in the middle of the option flag should not be treated as negatable. ([#1301])
58
59## [6.0.0-0] (2020-06-20)
60
61(Released in 6.0.0)
62
63## [5.1.0] (2020-04-25)
64
65### Added
66
67- support for multiple command aliases, the first of which is shown in the auto-generated help ([#531], [#1236])
68- configuration support in `addCommand()` for `hidden` and `isDefault` ([#1232])
69
70### Fixed
71
72- omit masked help flags from the displayed help ([#645], [#1247])
73- remove old short help flag when change help flags using `helpOption` ([#1248])
74
75### Changed
76
77- remove use of `arguments` to improve auto-generated help in editors ([#1235])
78- rename `.command()` configuration `noHelp` to `hidden` (but not remove old support) ([#1232])
79- improvements to documentation
80- update dependencies
81- update tested versions of node
82- eliminate lint errors in TypeScript ([#1208])
83
84## [5.0.0] (2020-03-14)
85
86### Added
87
88* support for nested commands with action-handlers ([#1] [#764] [#1149])
89* `.addCommand()` for adding a separately configured command ([#764] [#1149])
90* allow a non-executable to be set as the default command ([#742] [#1149])
91* implicit help command when there are subcommands (previously only if executables) ([#1149])
92* customise implicit help command with `.addHelpCommand()` ([#1149])
93* display error message for unknown subcommand, by default ([#432] [#1088] [#1149])
94* display help for missing subcommand, by default ([#1088] [#1149])
95* 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])
96* `.parseOption()` includes short flag and long flag expansions ([#1145])
97* `.helpInformation()` returns help text as a string, previously a private routine ([#1169])
98* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172])
99* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172])
100* suggest help option along with unknown command error ([#1179])
101* TypeScript definition for `commands` property of `Command` ([#1184])
102* export `program` property ([#1195])
103* `createCommand` factory method to simplify subclassing ([#1191])
104
105### Fixed
106
107* preserve argument order in subcommands ([#508] [#962] [#1138])
108* do not emit `command:*` for executable subcommands ([#809] [#1149])
109* action handler called whether or not there are non-option arguments ([#1062] [#1149])
110* combining option short flag and value in single argument now works for subcommands ([#1145])
111* only add implicit help command when it will not conflict with other uses of argument ([#1153] [#1149])
112* implicit help command works with command aliases ([#948] [#1149])
113* options are validated whether or not there is an action handler ([#1149])
114
115### Changed
116
117* *Breaking* `.args` contains command arguments with just recognised options removed ([#1032] [#1138])
118* *Breaking* display error if required argument for command is missing ([#995] [#1149])
119* tighten TypeScript definition of custom option processing function passed to `.option()` ([#1119])
120* *Breaking* `.allowUnknownOption()` ([#802] [#1138])
121 * unknown options included in arguments passed to command action handler
122 * unknown options included in `.args`
123* only recognised option short flags and long flags are expanded (e.g. `-ab` or `--foo=bar`) ([#1145])
124* *Breaking* `.parseOptions()` ([#1138])
125 * `args` in returned result renamed `operands` and does not include anything after first unknown option
126 * `unknown` in returned result has arguments after first unknown option including operands, not just options and values
127* *Breaking* `.on('command:*', callback)` and other command events passed (changed) results from `.parseOptions`, i.e. operands and unknown ([#1138])
128* refactor Option from prototype to class ([#1133])
129* refactor Command from prototype to class ([#1159])
130* changes to error handling ([#1165])
131 * throw for author error, not just display message
132 * preflight for variadic error
133 * add tips to missing subcommand executable
134* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])
135* `.parseAsync` returns `Promise<this>` to be consistent with `.parse()` ([#1180])
136* update dependencies
137
138### Removed
139
140* removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on `@types/node` ([#1146])
141* removed private function `normalize` (the functionality has been integrated into `parseOptions`) ([#1145])
142* `parseExpectedArgs` is now private ([#1149])
143
144### Migration Tips
145
146If you use `.on('command:*')` or more complicated tests to detect an unrecognised subcommand, you may be able to delete the code and rely on the default behaviour.
147
148If 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.
149
150If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command.
151
152If you want to continue combining short options with optional values as though they were boolean flags, set `combineFlagAndOptionalValue(false)`
153to expand `-fb` to `-f -b` rather than `-f b`.
154
155## [5.0.0-4] (2020-03-03)
156
157(Released in 5.0.0)
158
159## [5.0.0-3] (2020-02-20)
160
161(Released in 5.0.0)
162
163## [5.0.0-2] (2020-02-10)
164
165(Released in 5.0.0)
166
167## [5.0.0-1] (2020-02-08)
168
169(Released in 5.0.0)
170
171## [5.0.0-0] (2020-02-02)
172
173(Released in 5.0.0)
174
175## [4.1.1] (2020-02-02)
176
177### Fixed
178
179* TypeScript definition for `.action()` should include Promise for async ([#1157])
180
181## [4.1.0] (2020-01-06)
182
183### Added
184
185* two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] [#1102])
186 * see storeOptionsAsProperties and passCommandToAction in README
187* `.parseAsync` to use instead of `.parse` if supply async action handlers ([#806] [#1118])
188
189### Fixed
190
191* Remove trailing blanks from wrapped help text ([#1096])
192
193### Changed
194
195* update dependencies
196* extend security coverage for Commander 2.x to 2020-02-03
197* improvements to README
198* improvements to TypeScript definition documentation
199* move old versions out of main CHANGELOG
200* removed explicit use of `ts-node` in tests
201
202## [4.0.1] (2019-11-12)
203
204### Fixed
205
206* display help when requested, even if there are missing required options ([#1091])
207
208## [4.0.0] (2019-11-02)
209
210### Added
211
212* automatically wrap and indent help descriptions for options and commands ([#1051])
213* `.exitOverride()` allows override of calls to `process.exit` for additional error handling and to keep program running ([#1040])
214* support for declaring required options with `.requiredOptions()` ([#1071])
215* GitHub Actions support ([#1027])
216* translation links in README
217
218### Changed
219
220* dev: switch tests from Sinon+Should to Jest with major rewrite of tests ([#1035])
221* call default subcommand even when there are unknown options ([#1047])
222* *Breaking* Commander is only officially supported on Node 8 and above, and requires Node 6 ([#1053])
223
224### Fixed
225
226* *Breaking* keep command object out of program.args when action handler called ([#1048])
227 * also, action handler now passed array of unknown arguments
228* complain about unknown options when program argument supplied and action handler ([#1049])
229 * this changes parameters to `command:*` event to include unknown arguments
230* removed deprecated `customFds` option from call to `child_process.spawn` ([#1052])
231* rework TypeScript declarations to bring all types into imported namespace ([#1081])
232
233### Migration Tips
234
235#### Testing for no arguments
236
237If you were previously using code like:
238
239```js
240if (!program.args.length) ...
241```
242
243a partial replacement is:
244
245```js
246if (program.rawArgs.length < 3) ...
247```
248
249## [4.0.0-1] Prerelease (2019-10-08)
250
251(Released in 4.0.0)
252
253## [4.0.0-0] Prerelease (2019-10-01)
254
255(Released in 4.0.0)
256
257## Older versions
258
259* [3.x](./changelogs/CHANGELOG-3.md)
260* [2.x](./changelogs/CHANGELOG-2.md)
261* [1.x](./changelogs/CHANGELOG-1.md)
262* [0.x](./changelogs/CHANGELOG-0.md)
263
264[#1]: https://github.com/tj/commander.js/issues/1
265[#432]: https://github.com/tj/commander.js/issues/432
266[#508]: https://github.com/tj/commander.js/issues/508
267[#512]: https://github.com/tj/commander.js/issues/512
268[#531]: https://github.com/tj/commander.js/issues/531
269[#645]: https://github.com/tj/commander.js/issues/645
270[#742]: https://github.com/tj/commander.js/issues/742
271[#764]: https://github.com/tj/commander.js/issues/764
272[#802]: https://github.com/tj/commander.js/issues/802
273[#806]: https://github.com/tj/commander.js/issues/806
274[#809]: https://github.com/tj/commander.js/issues/809
275[#948]: https://github.com/tj/commander.js/issues/948
276[#962]: https://github.com/tj/commander.js/issues/962
277[#995]: https://github.com/tj/commander.js/issues/995
278[#1027]: https://github.com/tj/commander.js/pull/1027
279[#1032]: https://github.com/tj/commander.js/issues/1032
280[#1035]: https://github.com/tj/commander.js/pull/1035
281[#1040]: https://github.com/tj/commander.js/pull/1040
282[#1047]: https://github.com/tj/commander.js/pull/1047
283[#1048]: https://github.com/tj/commander.js/pull/1048
284[#1049]: https://github.com/tj/commander.js/pull/1049
285[#1051]: https://github.com/tj/commander.js/pull/1051
286[#1052]: https://github.com/tj/commander.js/pull/1052
287[#1053]: https://github.com/tj/commander.js/pull/1053
288[#1062]: https://github.com/tj/commander.js/pull/1062
289[#1071]: https://github.com/tj/commander.js/pull/1071
290[#1081]: https://github.com/tj/commander.js/pull/1081
291[#1088]: https://github.com/tj/commander.js/issues/1088
292[#1091]: https://github.com/tj/commander.js/pull/1091
293[#1096]: https://github.com/tj/commander.js/pull/1096
294[#1102]: https://github.com/tj/commander.js/pull/1102
295[#1118]: https://github.com/tj/commander.js/pull/1118
296[#1119]: https://github.com/tj/commander.js/pull/1119
297[#1133]: https://github.com/tj/commander.js/pull/1133
298[#1138]: https://github.com/tj/commander.js/pull/1138
299[#1145]: https://github.com/tj/commander.js/pull/1145
300[#1146]: https://github.com/tj/commander.js/pull/1146
301[#1149]: https://github.com/tj/commander.js/pull/1149
302[#1153]: https://github.com/tj/commander.js/issues/1153
303[#1157]: https://github.com/tj/commander.js/pull/1157
304[#1159]: https://github.com/tj/commander.js/pull/1159
305[#1165]: https://github.com/tj/commander.js/pull/1165
306[#1169]: https://github.com/tj/commander.js/pull/1169
307[#1172]: https://github.com/tj/commander.js/pull/1172
308[#1179]: https://github.com/tj/commander.js/pull/1179
309[#1180]: https://github.com/tj/commander.js/pull/1180
310[#1184]: https://github.com/tj/commander.js/pull/1184
311[#1191]: https://github.com/tj/commander.js/pull/1191
312[#1195]: https://github.com/tj/commander.js/pull/1195
313[#1208]: https://github.com/tj/commander.js/pull/1208
314[#1232]: https://github.com/tj/commander.js/pull/1232
315[#1235]: https://github.com/tj/commander.js/pull/1235
316[#1236]: https://github.com/tj/commander.js/pull/1236
317[#1247]: https://github.com/tj/commander.js/pull/1247
318[#1248]: https://github.com/tj/commander.js/pull/1248
319[#1250]: https://github.com/tj/commander.js/pull/1250
320[#1256]: https://github.com/tj/commander.js/pull/1256
321[#1275]: https://github.com/tj/commander.js/pull/1275
322[#1301]: https://github.com/tj/commander.js/issues/1301
323[#1306]: https://github.com/tj/commander.js/pull/1306
324[#1312]: https://github.com/tj/commander.js/pull/1312
325[#1322]: https://github.com/tj/commander.js/pull/1322
326[#1323]: https://github.com/tj/commander.js/pull/1323
327[#1325]: https://github.com/tj/commander.js/pull/1325
328[#1326]: https://github.com/tj/commander.js/pull/1326
329[#1332]: https://github.com/tj/commander.js/pull/1332
330[#1353]: https://github.com/tj/commander.js/pull/1353
331[#1360]: https://github.com/tj/commander.js/pull/1360
332[#1361]: https://github.com/tj/commander.js/pull/1361
333[#1368]: https://github.com/tj/commander.js/pull/1368
334[#1375]: https://github.com/tj/commander.js/pull/1375
335
336
337[Unreleased]: https://github.com/tj/commander.js/compare/master...develop
338[6.2.0]: https://github.com/tj/commander.js/compare/v6.1.0..v6.2.0
339[6.1.0]: https://github.com/tj/commander.js/compare/v6.0.0..v6.1.0
340[6.0.0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0
341[6.0.0-0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0-0
342[5.1.0]: https://github.com/tj/commander.js/compare/v5.0.0..v5.1.0
343[5.0.0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0
344[5.0.0-4]: https://github.com/tj/commander.js/compare/v5.0.0-3..v5.0.0-4
345[5.0.0-3]: https://github.com/tj/commander.js/compare/v5.0.0-2..v5.0.0-3
346[5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2
347[5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-1
348[5.0.0-0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0-0
349[4.1.1]: https://github.com/tj/commander.js/compare/v4.1.0..v4.1.1
350[4.1.0]: https://github.com/tj/commander.js/compare/v4.0.1..v4.1.0
351[4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1
352[4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0
353[4.0.0-1]: https://github.com/tj/commander.js/compare/v4.0.0-0..v4.0.0-1
354[4.0.0-0]: https://github.com/tj/commander.js/compare/v3.0.2...v4.0.0-0