Skip to content

Commit 066e381

Browse files
authored
Add Removed section to Deprecated (#2078)
1 parent 9821f3a commit 066e381

File tree

1 file changed

+49
-46
lines changed

1 file changed

+49
-46
lines changed

docs/deprecated.md

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ These features are deprecated, which means they may go away in a future major ve
44
They are currently still available for backwards compatibility, but should not be used in new code.
55

66
- [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
2122

2223
The `.option()` method allowed a RegExp as the third parameter to restrict what values were accepted.
2324

@@ -29,7 +30,7 @@ Removed from README in Commander v3. Deprecated from Commander v7.
2930

3031
The newer functionality is the Option `.choices()` method, or using a custom option processing function.
3132

32-
## noHelp
33+
### noHelp
3334

3435
This was an option passed to `.command()` to hide the command from the built-in help:
3536

@@ -39,29 +40,7 @@ program.command('example', 'example command', { noHelp: true });
3940

4041
The option was renamed `hidden` in Commander v5.1. Deprecated from Commander v7.
4142

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()
6544

6645
These routines allowed a callback parameter to process the built-in help before display.
6746

@@ -79,7 +58,7 @@ console.error(colors.red(program.helpInformation()));
7958

8059
Deprecated from Commander v7.
8160

82-
## .on('--help')
61+
### .on('--help')
8362

8463
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.
8564

@@ -104,7 +83,7 @@ Examples:
10483

10584
Deprecated from Commander v7.
10685

107-
## .on('command:*')
86+
### .on('command:*')
10887

10988
This was emitted when the command argument did not match a known subcommand (as part of the implementation of `.command('*')`).
11089

@@ -115,7 +94,7 @@ or for custom behaviour catch the `commander.unknownCommand` error.
11594

11695
Deprecated from Commander v8.3.
11796

118-
## .command('*')
97+
### .command('*')
11998

12099
This was used to add a default command to the program.
121100

@@ -135,7 +114,7 @@ program
135114

136115
Removed from README in Commander v5. Deprecated from Commander v8.3.
137116

138-
## cmd.description(cmdDescription, argDescriptions)
117+
### cmd.description(cmdDescription, argDescriptions)
139118

140119
This was used to add command argument descriptions for the help.
141120

@@ -158,7 +137,7 @@ program
158137

159138
Deprecated from Commander v8.
160139

161-
## InvalidOptionArgumentError
140+
### InvalidOptionArgumentError
162141

163142
This was used for throwing an error from custom option processing, for a nice error message.
164143

@@ -188,13 +167,13 @@ function myParseInt(value, dummyPrevious) {
188167

189168
Deprecated from Commander v8.
190169

191-
## Short option flag longer than a single character
170+
### Short option flag longer than a single character
192171

193172
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.
194173

195174
README updated in Commander v3. Deprecated from Commander v9.
196175

197-
## Import from `commander/esm.mjs`
176+
### Import from `commander/esm.mjs`
198177

199178
The first support for named imports required an explicit entry file.
200179

@@ -210,7 +189,7 @@ import { Command } from 'commander';
210189

211190
README updated in Commander v9. Deprecated from Commander v9.
212191

213-
## cmd._args
192+
### cmd._args
214193

215194
This was always private, but was previously the only way to access the command `Argument` array.
216195

@@ -225,3 +204,27 @@ const registeredArguments = program.registeredArguments;
225204
```
226205

227206
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

Comments
 (0)