1 # https://github.com/anishathalye/dotbot/issues/339
2 # plugins should be able to instantiate a Dispatcher with all the plugins
7 from dotbot
.dispatcher
import Dispatcher
10 class Dispatch(dotbot
.Plugin
):
11 def can_handle(self
, directive
: str) -> bool:
12 return directive
== "dispatch"
14 def handle(self
, directive
: str, data
: Any
) -> bool:
15 if directive
!= "dispatch":
16 msg
= f
"Dispatch cannot handle directive {directive}"
18 dispatcher
= Dispatcher(
19 base_directory
=self
._context
.base_directory(),
20 options
=self
._context
.options(),
21 plugins
=self
._context
.plugins(),
23 return dispatcher
.dispatch(data
)