Skip to content

Commit

Permalink
docs: {pre, post}Hook under Usage section (#64)
Browse files Browse the repository at this point in the history
* docs: `{pre, post}Hook` under `Usage` section

* sequence

---------

Co-authored-by: Sridhar Ratnakumar <[email protected]>
  • Loading branch information
shivaraj-bh and srid authored May 7, 2024
1 parent ee8cd50 commit 32c069e
Showing 1 changed file with 26 additions and 0 deletions.
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

0 comments on commit 32c069e

Please sign in to comment.