rules: tweak commands to make sure it handles subcommands #1876
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.
Description
Based on #1873
This PR tweaks the previous PR to replace spaces by a
-to generate command's label (the display name, not the "name" or the "regex"). It assumes that command name (and aliases) are not regular expression, but simple string, that needre.escape. That's a problem because apparently it wasn't a bug, but a feature.The thing is, if someone wants to use a subcommand today, they have to escape it manually, or to use a generic pattern that is hard to document, like this:
Which is quite odd. I discovered that problem by accident, and discussed with @dgw. I'll amend #1873 to make the system backward compatible, trying to be smart with it.
Meanwhile, this PR is published to show the tests and the documentation written for subcommands. This is the result of a reverse engineering, and I think Sopel will be better with it.
Checklist
make qa(runsmake qualityandmake test)