anishathalye / dotbot

A tool that bootstraps your dotfiles ⚡️
MIT License
7.04k stars 291 forks source link

Fix dispatcher when no plugins are given #332

Open Wanimatrix opened 1 year ago

Wanimatrix commented 1 year ago

When any plugin is using the dispatcher for nested actions it should pass all plugins again to avoid that any plugin as subtask would be handled. Currently this means a lot of plugins are broken because they don't pass plugins to the dispatcher.

To fix this, take all Plugin subclasses when no plugin is given (we should at least have the default plugins).

kurtmckee commented 1 year ago

I've submitted #343 to address this, but I think that it will respect the --disable-built-in-plugins option by simply returning the same Dispatcher instance after it is first instantiated.

As a side effect, #343 introduces a cached Dispatcher instance that plugins can begin leveraging -- they can simply access dotbot.dispatcher.current_dispatcher directly instead of re-instantiating the Dispatcher class.