Coverage for src / dotbot / plugin.py: 86%
14 statements
« prev ^ index » next coverage.py v7.12.0, created at 2025-11-29 10:55 -0800
« prev ^ index » next coverage.py v7.12.0, created at 2025-11-29 10:55 -0800
1from typing import Any
3from dotbot.context import Context
4from dotbot.messenger import Messenger
7class Plugin:
8 """
9 Abstract base class for commands that process directives.
10 """
12 _context: Context
13 _log: Messenger
14 supports_dry_run: bool = False # plugins must explicitly declare support for dry-run mode
16 def __init__(self, context: Context):
17 self._context = context
18 self._log = Messenger()
20 def can_handle(self, directive: str) -> bool:
21 """
22 Returns true if the Plugin can handle the directive.
23 """
24 raise NotImplementedError
26 def handle(self, directive: str, data: Any) -> bool:
27 """
28 Executes the directive.
30 Returns true if the Plugin successfully handled the directive.
31 """
32 raise NotImplementedError