Document how to run recipes after another recipe (#630)
Add a section to the readme documenting how to shell out to Just at the end of a recipe, to simulate dependencies that run after a recipe, instead of before. This is certainly not as good as having an explicit syntax for this, but it's a common question so it would be good to document the current best workaround.
This commit is contained in:
parent
2e6e48d8f4
commit
4fdb771731
32
README.adoc
32
README.adoc
@ -613,6 +613,38 @@ search QUERY:
|
|||||||
lynx 'https://www.google.com/?q={{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
|
=== Writing Recipes in Other Languages
|
||||||
|
|
||||||
Recipes that start with a `#!` are executed as scripts, so you can write recipes in other languages:
|
Recipes that start with a `#!` are executed as scripts, so you can write recipes in other languages:
|
||||||
|
Loading…
Reference in New Issue
Block a user