-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commander unsafely allows commands with duplicate name
s to be registered
#1903
Comments
Commander does not have tests for all possible mistakes/accidental-misuse by the "author", but willing to consider more as they come up. Mixing in plugins does make it possible for the issue to come up for the end-user rather than for the author as such. The duplicate primary name does have a dubious outcome. I am less worried about aliases clashing, but could perhaps actually handle this and ignore clashing alias when command is added. |
Opened #1924 with a fix. |
Reworked PR in #2059. |
Released in Commander v12.0.0. |
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 theArray.find
based lookup onname
, meant that repeat calls tocommand()
produced unexpected behaviour (the most recent call does not redeclare the command).At minimum, I believe this should error.
Example
Output will always be the first.
Expectation
Shouldn't allow duplicates and should throw an exception if a
name
already exists.The text was updated successfully, but these errors were encountered: