98e36aa916d7abdfd37c5363f921c08cf67b21a1fcc04123cd6d4b976dd2fdedfbd060db4edfdfbaa0be0df2df616360a072d37e9f9072ee08888a15394b81 15 KB

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