diff --git a/doc/index.md b/doc/index.md index 0867075..557a24e 100644 --- a/doc/index.md +++ b/doc/index.md @@ -74,6 +74,32 @@ devShells = { You can enter your devShell by running `nix develop` and run `watch-server` to run your processes. +### preHook + +If you'd like to run certain commands before starting the processes, you can add them to `preHook`: + +```nix +process-compose.watch-server = { + preHook = '' + # Cleanup on EXIT, this runs irrespective of exit-code of process-compose + trap "rm -rf ./data" EXIT + export USER=foo + ''; +}; +``` + +### postHook + +Or if you'd like to run certain commands upon successful execution of `process-compose`, i.e exits with `exit-code: 0`, then add them to `postHook`: + +```nix +process-compose.watch-server = { + postHook = '' + cat foo.txt + ''; +}; +``` + ## Module API Our submodule mirrors the [process-compose YAML schema](https://github.com/F1bonacc1/process-compose/blob/main/process-compose.yaml). A few things to remember: