You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+70Lines changed: 70 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,63 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8
8
<!-- markdownlint-disable MD024 -->
9
9
<!-- markdownlint-disable MD004 -->
10
10
11
+
## [12.0.0] (2024-02-03)
12
+
13
+
### Added
14
+
15
+
-`.addHelpOption()` as another way of configuring built-in help option ([#2006])
16
+
-`.helpCommand()` for configuring built-in help command ([#2087])
17
+
18
+
### Fixed
19
+
20
+
-*Breaking:* use non-zero exit code when spawned executable subcommand terminates due to a signal ([#2023])
21
+
-*Breaking:* check `passThroughOptions` constraints when using `.addCommand` and throw if parent command does not have `.enablePositionalOptions()` enabled ([#1937])
22
+
23
+
### Changed
24
+
25
+
-*Breaking:* Commander 12 requires Node.js v18 or higher ([#2027])
26
+
-*Breaking:* throw an error if add an option with a flag which is already in use ([#2055])
27
+
-*Breaking:* throw an error if add a command with name or alias which is already in use ([#2059])
28
+
-*Breaking:* throw error when calling `.storeOptionsAsProperties()` after setting an option value ([#1928])
29
+
- replace non-standard JSDoc of `@api private` with documented `@private` ([#1949])
30
+
-`.addHelpCommand()` now takes a Command (passing string or boolean still works as before but deprecated) ([#2087])
31
+
- refactor internal implementation of built-in help option ([#2006])
32
+
- refactor internal implementation of built-in help command ([#2087])
33
+
34
+
### Deprecated
35
+
36
+
-`.addHelpCommand()` passing string or boolean (use `.helpCommand()` or pass a Command) ([#2087])
37
+
38
+
### Removed
39
+
40
+
-*Breaking:* removed default export of a global Command instance from CommonJS (use the named `program` export instead) ([#2017])
41
+
42
+
### Migration Tips
43
+
44
+
**global program**
45
+
46
+
If you are using the [deprecated](./docs/deprecated.md#default-import-of-global-command-object) default import of the global Command object, you need to switch to using a named import (or create a new `Command`).
47
+
48
+
```js
49
+
// const program = require('commander');
50
+
const { program } =require('commander');
51
+
```
52
+
53
+
**option and command clashes**
54
+
55
+
A couple of configuration problems now throw an error, which will pick up issues in existing programs:
56
+
57
+
- adding an option which uses the same flag as a previous option
58
+
- adding a command which uses the same name or alias as a previous command
.helpOption('-e, --HELP', 'read more information');
905
905
```
906
906
907
-
### .addHelpCommand()
907
+
(Or use `.addHelpOption()` to add an option you construct yourself.)
908
908
909
-
A help command is added by default if your command has subcommands. You can explicitly turn on or off the implicit help command with `.addHelpCommand()` and `.addHelpCommand(false)`.
909
+
### .helpCommand()
910
+
911
+
A help command is added by default if your command has subcommands. You can explicitly turn on or off the implicit help command with `.helpCommand(true)` and `.helpCommand(false)`.
910
912
911
913
You can both turn on and customise the help command by supplying the name and description:
This was used to add command argument descriptions for the help.
140
121
@@ -157,7 +138,7 @@ program
157
138
158
139
Deprecated from Commander v8.
159
140
160
-
## InvalidOptionArgumentError
141
+
###InvalidOptionArgumentError
161
142
162
143
This was used for throwing an error from custom option processing, for a nice error message.
163
144
@@ -187,13 +168,13 @@ function myParseInt(value, dummyPrevious) {
187
168
188
169
Deprecated from Commander v8.
189
170
190
-
## Short option flag longer than a single character
171
+
###Short option flag longer than a single character
191
172
192
173
Short option flags like `-ws` were never supported, but the old README did not make this clear. The README now states that short options are a single character.
193
174
194
175
README updated in Commander v3. Deprecated from Commander v9.
195
176
196
-
## Import from `commander/esm.mjs`
177
+
###Import from `commander/esm.mjs`
197
178
198
179
The first support for named imports required an explicit entry file.
199
180
@@ -209,7 +190,7 @@ import { Command } from 'commander';
209
190
210
191
README updated in Commander v9. Deprecated from Commander v9.
211
192
212
-
## cmd._args
193
+
###cmd._args
213
194
214
195
This was always private, but was previously the only way to access the command `Argument` array.
0 commit comments