Skip to content

Commit 1266e14

Browse files
committed
feat: allow plugin.register to be used as a decorator
1 parent 135f1ba commit 1266e14

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

simplug.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,10 @@ def register(self, *plugins: Any) -> None:
831831

832832
self._batch_index += 1
833833

834+
if len(plugins) == 1 and callable(plugins[0]):
835+
# allow to use as a decorator
836+
return plugins[0]
837+
834838
def get_plugin(self, name: str, raw: bool = False) -> object:
835839
"""Get the plugin wrapper or the raw plugin object
836840

0 commit comments

Comments
 (0)