Skip to content
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

plugin: keep old-school plugin devs happy w/plural command decorators #1967

Merged
merged 2 commits into from
Dec 14, 2020

Conversation

dgw
Copy link
Member

@dgw dgw commented Oct 20, 2020

Description

Enough people expressed dismay that our upcoming migration to sopel.plugin (from sopel.module) would get rid of the plural commands decorator family. So we can have both, and plugin devs may choose depending on how they decorate stuff.

@plugin.command('justone')
def one_name(bot, trigger):
    pass

@plugin.commands('multiple', 'names')
def two_names(bot, trigger):
    pass

I gave the aliases very short docstrings that just link back to the main entry, so Sphinx wouldn't duplicate the whole shebang.
Locally built preview:

image

@Exirel, is adding tests for the aliases worthwhile? I don't feel like bothering. 😝

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

The aliases' docstrings should prevent Sphinx from outputting the same
documentation twice; a simple link to the main definition is enough.
@dgw dgw added the Tweak label Oct 20, 2020
@dgw dgw added this to the 7.1.0 milestone Oct 20, 2020
@dgw dgw requested a review from a team October 20, 2020 21:34
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update sopel.module's imports as well.

@dgw
Copy link
Member Author

dgw commented Oct 21, 2020

@Exirel Wait, so now you're in favor of touching deprecated stuffs? 😼

@Exirel
Copy link
Contributor

Exirel commented Oct 22, 2020

@dgw your PR is about un-deprecating commands, tho.

@dgw
Copy link
Member Author

dgw commented Oct 22, 2020

@Exirel plugin.commands wasn't deprecated; it never existed (except briefly in an unreleased state, between #1898 and #1924, for about a month). It's just, after the little row we had over touching deprecated code in #1944, I was surprised that you wanted me to do so here. It makes sense. Importing with as is silly if not needed. Just didn't expect it.

@dgw dgw merged commit 3a27545 into master Dec 14, 2020
@dgw dgw deleted the plugin-plural-aliases branch December 14, 2020 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants