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

Document how to run recipes after a recipe is done #630

Merged
merged 2 commits into from
May 26, 2020
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
32 changes: 32 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,38 @@ search QUERY:
lynx 'https://www.google.com/?q={{QUERY}}'
```

=== Running recipes at the end of a recipe

Dependencies of a recipes always run before a recipe starts. That is to say, the dependee always runs before the depender.

You can call Just recursively to run a recipe after a recipe ends. Given the following justfile:

```make
a:
echo 'A!'

b: a
echo 'B!'
just c

c:
echo 'C!'
```

…running 'b' prints:

```sh
$ just b
echo 'A!'
A!
echo 'B!'
B!
echo 'C!'
C!
```

This has some limitations, since recipe `c` is run with an entirely new invocation of Just: Assignments will be recalculated, dependencies might run twice, and command line arguments will not be propagated to the child Just process.

=== Writing Recipes in Other Languages

Recipes that start with a `#!` are executed as scripts, so you can write recipes in other languages:
Expand Down