|
3 | 3 |
|
4 | 4 | * Add option to specify executable file name ([#999])
|
5 | 5 | * e.g. `.command('clone', 'clone description', { executableFile: 'myClone' })`
|
6 |
| - * Change docs for `.command` to contrast action handler vs git-style executable. TypeScript now uses overloaded function. ([#938] [#990]) |
| 6 | + * Change docs for `.command` to contrast action handler vs git-style executable. ([#938] [#990]) |
| 7 | + * **Breaking** Change TypeScript to use overloaded function for `.command`. ([#938] [#990]) |
7 | 8 | * Change to use straight quotes around strings in error messages (like 'this' instead of `this') ([#915])
|
8 | 9 | * Add TypeScript "reference types" for node ([#974])
|
9 | 10 | * Add support for hyphen as an option argument in subcommands ([#697])
|
|
18 | 19 | * e.g. `.helpOption('-e, --HELP', 'read more information')`
|
19 | 20 | * Fix behavior of --no-* options ([#795])
|
20 | 21 | * can now define both `--foo` and `--no-foo`
|
21 |
| - * custom event listeners: `--no-foo` on cli now emits `option:no-foo` (previously `option:foo`) |
22 |
| - * default value: defining `--no-foo` after defining `--foo` leaves the default value unchanged (previously set it to false) |
| 22 | + * **Breaking** custom event listeners: `--no-foo` on cli now emits `option:no-foo` (previously `option:foo`) |
| 23 | + * **Breaking** default value: defining `--no-foo` after defining `--foo` leaves the default value unchanged (previously set it to false) |
23 | 24 | * allow boolean default value, such as from environment ([#987])
|
24 | 25 | * Increment inspector port for spawned subcommands ([#991])
|
25 | 26 | * e.g. `node --inspect myCommand.js clone`
|
26 |
| - |
| 27 | + |
| 28 | +Example Breaking Changes |
| 29 | +------------------------ |
| 30 | + |
| 31 | +The custom event for a negated option like `--no-foo` is `option:no-foo` (previously `option:foo`). |
| 32 | + |
| 33 | +```js |
| 34 | +program |
| 35 | + .option('--no-foo') |
| 36 | + .on('option:no-foo', () => { |
| 37 | + console.log('removing foo'); |
| 38 | + }); |
| 39 | +``` |
| 40 | + |
| 41 | +When using TypeScript, adding a command does not allow an explicit `undefined` for an unwanted executable description (e.g |
| 42 | +for a command with an action handler). |
| 43 | + |
| 44 | +```js |
| 45 | +program |
| 46 | + .command('action1', undefined, { noHelp: true }) // No longer valid |
| 47 | + .command('action2', { noHelp: true }) // Correct |
| 48 | +``` |
| 49 | + |
27 | 50 | [#599]: https://github.com/tj/commander.js/issues/599
|
28 | 51 | [#611]: https://github.com/tj/commander.js/issues/611
|
29 | 52 | [#697]: https://github.com/tj/commander.js/issues/697
|
|
0 commit comments