2024-12-28 01:01:05 -05:00
|
|
|
from typing import Any
|
2024-12-07 17:29:45 -05:00
|
|
|
|
|
|
|
from dotbot.plugin import Plugin
|
2024-12-28 02:24:44 -05:00
|
|
|
from dotbot.plugins import Clean, Create, Link, Shell
|
2024-12-07 17:29:45 -05:00
|
|
|
|
|
|
|
# https://github.com/anishathalye/dotbot/issues/357
|
|
|
|
# if we import from dotbot.plugins, the built-in plugins get executed multiple times
|
2024-12-28 02:24:44 -05:00
|
|
|
_: Any = Clean
|
|
|
|
_ = Create
|
|
|
|
_ = Link
|
|
|
|
_ = Shell
|
2024-12-07 17:29:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
class NoopPlugin(Plugin):
|
|
|
|
_directive = "noop"
|
|
|
|
|
2024-12-28 01:01:05 -05:00
|
|
|
def can_handle(self, directive: str) -> bool:
|
2024-12-07 17:29:45 -05:00
|
|
|
return directive == self._directive
|
|
|
|
|
2024-12-28 01:01:05 -05:00
|
|
|
def handle(self, directive: str, _data: Any) -> bool:
|
|
|
|
if directive != self._directive:
|
|
|
|
msg = f"NoopPlugin cannot handle directive {directive}"
|
|
|
|
raise ValueError(msg)
|
2024-12-07 17:29:45 -05:00
|
|
|
return True
|