Transformed the help management to be implemented not using a command (CRAFT-542). #550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has several benefits:
The help handling is now more straightforward
The COMMAND_GROUPS constant does not include anything related to help anymore (more app isolation ot a future lib)
We're able to provide better messages when help was "requested wrong" (e.g. with too many parameters or an incorrect command); IMO this is very important, as we're able to guide the user better in a situation when they're a little lost (there is a reason they are asking for help...)
All help handling happens on the "initial args pre-parsing", and not one part there and one part when the command is run (this is transparent for the user, but useful for when Dispatcher will be in other lib)
We have only one minor drawbacks: 'help' itself, as a command, is not listed in the "basic commands group" anymore.
Note I added a ProvideHelpException exception to interrupt the normal flow of execution and finish the process providing a guiding text when help was requested correctly. This was a simple way to achieve this branch targets without moving a lot of code around, it may change in the future to be more simple when we isolate the Dispatcher further.