View Source Rewrite.Hook behaviour (rewrite v1.1.2)
A behaviour
for hooking into the Rewrite
processes.
The callback handle/2
is called by Rewrite
with an action/0
and the
current %Rewrite{}
. The return value is either :ok
or {:ok, rewrite}
.
Warning
If the %Rewrite{}
project is updated inside the hook, the hook will be
called again.
Actions
:new
- invoked when a new%Rewrite{}
is created.{:added, paths}
- invoked when new sources were added.paths
is the a list oft:Path.t()
.{:updated, path}
- invoked when a source was updated.path
contains the path of the updated source. Also called when a source was succesfull formatted.