As part of rewriting the parser in #2205, I was looking at the complexities of Click's definitions and processing. MultiCommand and CommandCollection could be combined with Group to simplify to a single way of working with multiple commands. This is a little more difficult than #2589 removing BaseCommand.
Currently, they're distinct because Group provides further group and command decorators. MultiCommand is the base and doesn't specify how commands are registered, and CommandCollection "flattens" multiple MultiCommands instead of nesting like Group.group.
The docs occasionally refer to "mulitcommand" instead of "group" in situations where the user would probably understand "group" better. There are very few examples in the docs of either class, and all of them can be reasonably implemented with Group instead.
#347 (and many linked issues) show a confusion over how CommandCollection is supposed to work. It doesn't use each source's parameters, and doesn't invoke the source's callback before a command. In other words, currently the collection only collects the commands in each source, but users expect it to merge the behavior of all sources. I'm not entirely convinced that we should continue to support either of these things. But we could continue to support the current behavior by adding Group.add_source or extend_commands with the same behavior, where the command is looked up first on the group, then on each source. In the future we could also add a merge_group method.
As part of rewriting the parser in #2205, I was looking at the complexities of Click's definitions and processing.
MultiCommandandCommandCollectioncould be combined withGroupto simplify to a single way of working with multiple commands. This is a little more difficult than #2589 removingBaseCommand.Currently, they're distinct because
Groupprovides furthergroupandcommanddecorators.MultiCommandis the base and doesn't specify how commands are registered, andCommandCollection"flattens" multipleMultiCommandsinstead of nesting likeGroup.group.The docs occasionally refer to "mulitcommand" instead of "group" in situations where the user would probably understand "group" better. There are very few examples in the docs of either class, and all of them can be reasonably implemented with
Groupinstead.#347 (and many linked issues) show a confusion over how
CommandCollectionis supposed to work. It doesn't use each source's parameters, and doesn't invoke the source's callback before a command. In other words, currently the collection only collects the commands in each source, but users expect it to merge the behavior of all sources. I'm not entirely convinced that we should continue to support either of these things. But we could continue to support the current behavior by addingGroup.add_sourceorextend_commandswith the same behavior, where the command is looked up first on the group, then on each source. In the future we could also add amerge_groupmethod.