-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
semver: majorReleasing requires a major version bump, not backwards compatibleReleasing requires a major version bump, not backwards compatible
Description
We ran into an issue recently in a project that depends on commander, which dynamically defines commands based on plugins. Commander's internal array data structure for commands, and the Array.find based lookup on name, meant that repeat calls to command() produced unexpected behaviour (the most recent call does not redeclare the command).
At minimum, I believe this should error.
Example
const { Command } = require('commander');
const program = new Command();
program.command('split').action((str, options) => console.log('1st'));
program.command('split').action((str, options) => console.log('2nd'));
program.parse();Output will always be the first.
$ node example
Usage: example [options] [command]
Options:
-h, --help display help for command
Commands:
split
split
help [command] display help for command
$ node example split
1stExpectation
Shouldn't allow duplicates and should throw an exception if a name already exists.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
semver: majorReleasing requires a major version bump, not backwards compatibleReleasing requires a major version bump, not backwards compatible