Add Removed section to Deprecated (#2078)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by John Gee · committed by GitHub · parent 9821f3a · Browse files · 1 file·+48 added−45 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+48 added−45 removed
- other:+48 added−45 removed
Provenance
- Commit
066e381- Tree
0749e61- Author
John Gee <john@ruru.gen.nz>- Committer
GitHub <noreply@github.com>- Parent
9821f3a
1 file changed+48 added−45 removed
modified:docs/deprecated.md+48 added-45 removed
2 unmodified lines3 These features are deprecated, which means they may go away in a future major version of Commander.4 They are currently still available for backwards compatibility, but should not be used in new code.5 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)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 20-## RegExp .option() parameter21+### RegExp .option() parameter22 23 The `.option()` method allowed a RegExp as the third parameter to restrict what values were accepted.24 25 ```js3 unmodified lines29 Removed from README in Commander v3. Deprecated from Commander v7.30 31 The newer functionality is the Option `.choices()` method, or using a custom option processing function.32 32-## noHelp33+### noHelp34 35 This was an option passed to `.command()` to hide the command from the built-in help:36 37 ```js1 unmodified line39 ```40 41 The option was renamed `hidden` in Commander v5.1. Deprecated from Commander v7.42 42-## Default import of global Command object43+### Callback to .help() and .outputHelp()44 44-The default import was a global Command object.45-46-```js47-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-```js53-const { program } = require('commander');54-// or55-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()65-45 These routines allowed a callback parameter to process the built-in help before display.46 47 ```js48 program.outputHelp((text) => {8 unmodified lines57 ```58 59 Deprecated from Commander v7.60 82-## .on('--help')61+### .on('--help')62 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.64 65 ```js16 unmodified lines82 ```83 84 Deprecated from Commander v7.85 107-## .on('command:*')86+### .on('command:*')87 88 This was emitted when the command argument did not match a known subcommand (as part of the implementation of `.command('*')`).89 90 One use was for adding an error for an unknown subcommand. An error is now the default built-in behaviour.2 unmodified lines93 or for custom behaviour catch the `commander.unknownCommand` error.94 95 Deprecated from Commander v8.3.96 118-## .command('*')97+### .command('*')98 99 This was used to add a default command to the program.100 101 ```js11 unmodified lines113 ```114 115 Removed from README in Commander v5. Deprecated from Commander v8.3.116 138-## cmd.description(cmdDescription, argDescriptions)117+### cmd.description(cmdDescription, argDescriptions)118 119 This was used to add command argument descriptions for the help.120 121 ```js14 unmodified lines136 ```137 138 Deprecated from Commander v8.139 161-## InvalidOptionArgumentError140+### InvalidOptionArgumentError141 142 This was used for throwing an error from custom option processing, for a nice error message.143 144 ```js21 unmodified lines166 ```167 168 Deprecated from Commander v8.169 191-## Short option flag longer than a single character170+### Short option flag longer than a single character171 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.173 174 README updated in Commander v3. Deprecated from Commander v9.175 197-## Import from `commander/esm.mjs`176+### Import from `commander/esm.mjs`177 178 The first support for named imports required an explicit entry file.179 180 ```js7 unmodified lines188 ```189 190 README updated in Commander v9. Deprecated from Commander v9.191 213-## cmd._args192+### cmd._args193 194 This was always private, but was previously the only way to access the command `Argument` array.195 196 ```js6 unmodified lines203 const registeredArguments = program.registeredArguments;204 ```205 206 Deprecated from Commander v11.207+208+## Removed209+210+### Default import of global Command object211+212+The default import was a global Command object.213+214+```js215+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+```js221+const { program } = require('commander');222+// or223+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!