@@ -4,20 +4,21 @@ These features are deprecated, which means they may go away in a future major ve
4
4
They are currently still available for backwards compatibility, but should not be used in new code.
5
5
6
6
- [ Deprecated] ( #deprecated )
7
- - [ RegExp .option() parameter] ( #regexp-option-parameter )
8
- - [ noHelp] ( #nohelp )
9
- - [ Default import of global Command object] ( #default-import-of-global-command-object )
10
- - [ Callback to .help() and .outputHelp()] ( #callback-to-help-and-outputhelp )
11
- - [ .on('--help')] ( #on--help )
12
- - [ .on('command:\* ')] ( #oncommand )
13
- - [ .command('\* ')] ( #command )
14
- - [ cmd.description(cmdDescription, argDescriptions)] ( #cmddescriptioncmddescription-argdescriptions )
15
- - [ InvalidOptionArgumentError] ( #invalidoptionargumenterror )
16
- - [ Short option flag longer than a single character] ( #short-option-flag-longer-than-a-single-character )
17
- - [ Import from ` commander/esm.mjs ` ] ( #import-from-commanderesmmjs )
18
- - [ cmd.\_ args] ( #cmd_args )
19
-
20
- ## RegExp .option() parameter
7
+ - [ RegExp .option() parameter] ( #regexp-option-parameter )
8
+ - [ noHelp] ( #nohelp )
9
+ - [ Callback to .help() and .outputHelp()] ( #callback-to-help-and-outputhelp )
10
+ - [ .on('--help')] ( #on--help )
11
+ - [ .on('command:\* ')] ( #oncommand )
12
+ - [ .command('\* ')] ( #command )
13
+ - [ cmd.description(cmdDescription, argDescriptions)] ( #cmddescriptioncmddescription-argdescriptions )
14
+ - [ InvalidOptionArgumentError] ( #invalidoptionargumenterror )
15
+ - [ Short option flag longer than a single character] ( #short-option-flag-longer-than-a-single-character )
16
+ - [ Import from ` commander/esm.mjs ` ] ( #import-from-commanderesmmjs )
17
+ - [ cmd.\_ args] ( #cmd_args )
18
+ - [ Removed] ( #removed )
19
+ - [ Default import of global Command object] ( #default-import-of-global-command-object )
20
+
21
+ ### RegExp .option() parameter
21
22
22
23
The ` .option() ` method allowed a RegExp as the third parameter to restrict what values were accepted.
23
24
@@ -29,7 +30,7 @@ Removed from README in Commander v3. Deprecated from Commander v7.
29
30
30
31
The newer functionality is the Option ` .choices() ` method, or using a custom option processing function.
31
32
32
- ## noHelp
33
+ ### noHelp
33
34
34
35
This was an option passed to ` .command() ` to hide the command from the built-in help:
35
36
@@ -39,29 +40,7 @@ program.command('example', 'example command', { noHelp: true });
39
40
40
41
The option was renamed ` hidden ` in Commander v5.1. Deprecated from Commander v7.
41
42
42
- ## Default import of global Command object
43
-
44
- The default import was a global Command object.
45
-
46
- ``` js
47
- const program = require (' commander' );
48
- ```
49
-
50
- The global Command object is exported as ` program ` from Commander v5, or import the Command object.
51
-
52
- ``` js
53
- const { program } = require (' commander' );
54
- // or
55
- const { Command } = require (' commander' );
56
- const program = new Command ()
57
- ```
58
-
59
- - Removed from README in Commander v5.
60
- - Deprecated from Commander v7.
61
- - Removed from TypeScript declarations in Commander v8.
62
- - Removed from CommonJS in Commander v12. Deprecated and gone!
63
-
64
- ## Callback to .help() and .outputHelp()
43
+ ### Callback to .help() and .outputHelp()
65
44
66
45
These routines allowed a callback parameter to process the built-in help before display.
67
46
@@ -79,7 +58,7 @@ console.error(colors.red(program.helpInformation()));
79
58
80
59
Deprecated from Commander v7.
81
60
82
- ## .on('--help')
61
+ ### .on('--help')
83
62
84
63
This was the way to add custom help after the built-in help. From Commander v3.0.0 this used the custom long help option flags, if changed.
85
64
@@ -104,7 +83,7 @@ Examples:
104
83
105
84
Deprecated from Commander v7.
106
85
107
- ## .on('command:* ')
86
+ ### .on('command:* ')
108
87
109
88
This was emitted when the command argument did not match a known subcommand (as part of the implementation of ` .command('*') ` ).
110
89
@@ -115,7 +94,7 @@ or for custom behaviour catch the `commander.unknownCommand` error.
115
94
116
95
Deprecated from Commander v8.3.
117
96
118
- ## .command('* ')
97
+ ### .command('* ')
119
98
120
99
This was used to add a default command to the program.
121
100
@@ -135,7 +114,7 @@ program
135
114
136
115
Removed from README in Commander v5. Deprecated from Commander v8.3.
137
116
138
- ## cmd.description(cmdDescription, argDescriptions)
117
+ ### cmd.description(cmdDescription, argDescriptions)
139
118
140
119
This was used to add command argument descriptions for the help.
141
120
@@ -158,7 +137,7 @@ program
158
137
159
138
Deprecated from Commander v8.
160
139
161
- ## InvalidOptionArgumentError
140
+ ### InvalidOptionArgumentError
162
141
163
142
This was used for throwing an error from custom option processing, for a nice error message.
164
143
@@ -188,13 +167,13 @@ function myParseInt(value, dummyPrevious) {
188
167
189
168
Deprecated from Commander v8.
190
169
191
- ## Short option flag longer than a single character
170
+ ### Short option flag longer than a single character
192
171
193
172
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.
194
173
195
174
README updated in Commander v3. Deprecated from Commander v9.
196
175
197
- ## Import from ` commander/esm.mjs `
176
+ ### Import from ` commander/esm.mjs `
198
177
199
178
The first support for named imports required an explicit entry file.
200
179
@@ -210,7 +189,7 @@ import { Command } from 'commander';
210
189
211
190
README updated in Commander v9. Deprecated from Commander v9.
212
191
213
- ## cmd._ args
192
+ ### cmd._ args
214
193
215
194
This was always private, but was previously the only way to access the command ` Argument ` array.
216
195
@@ -225,3 +204,27 @@ const registeredArguments = program.registeredArguments;
225
204
```
226
205
227
206
Deprecated from Commander v11.
207
+
208
+ ## Removed
209
+
210
+ ### Default import of global Command object
211
+
212
+ The default import was a global Command object.
213
+
214
+ ``` js
215
+ const program = require (' commander' );
216
+ ```
217
+
218
+ The global Command object is exported as ` program ` from Commander v5, or import the Command object.
219
+
220
+ ``` js
221
+ const { program } = require (' commander' );
222
+ // or
223
+ const { Command } = require (' commander' );
224
+ const program = new Command ()
225
+ ```
226
+
227
+ - Removed from README in Commander v5.
228
+ - Deprecated from Commander v7.
229
+ - Removed from TypeScript declarations in Commander v8.
230
+ - Removed from CommonJS in Commander v12. Deprecated and gone!
0 commit comments