Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: {pre, post}Hook under Usage section #64

Merged
merged 2 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading