evaera / Cmdr

Extensible command console for Roblox developers
https://eryn.io/Cmdr/
MIT License
372 stars 108 forks source link

Handling name conflicts between a builtin and developer-specified command or type #339

Open autonordev opened 1 month ago

autonordev commented 1 month ago

If two commands are registered with the same name, the last one registered replaces the original. But since we can't predict if users register default or custom commands last, it could lead to unintended overwriting of custom commands by default ones.

Originally posted by @wilyt1 in https://github.com/evaera/Cmdr/issues/327#issuecomment-2221263008

I think it's an accurate assumption that most people are registering built-in stuff first, but you know what they say about assumptions! Imo it risks introducing breaking changes, violating both semver and Cmdr's reputation for stability.

If there's a conflict between a built-in command or type and a developer-registered one, the developer one should take priority irrespective of which was registered later. For a conflict between two developer-registered commands, the one registered later should take priority (I believe this is the current behaviour.)

A warning should be emitted in either case so that way there's no surprises for the developer.