Skip to content

Commit

Permalink
Add notes about environment variables to readme (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jun 14, 2022
1 parent c710d5a commit 8c0bb3d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

This readme is also available as a [book](https://just.systems/man/en/);

(中文文档在 [这里](README.中文.md), 快看过来!)
(中文文档在 [这里](https://github.com/casey/just/blob/master/README.中文.md), 快看过来!)

Commands, called recipes, are stored in a file called `justfile` with syntax inspired by `make`:

Expand Down Expand Up @@ -1594,6 +1594,22 @@ foo:
echo $x
```

### Sharing Environment Variables Between Recipes

Each line of each recipe is executed by a fresh shell, so it is not possible to share environment variables between recipes.

#### Using Python Virtual Environments

Some tools, like [Python's venv](https://docs.python.org/3/library/venv.html), require loading environment variables in order to work, making them challenging to use with `just`. As a workaround, you can execute the virtual environment binaries directly:

```make
venv:
[ -d foo ] || python3 -m venv foo

run: venv
./foo/bin/python3 main.py
```

### Changing the Working Directory in a Recipe

Each recipe line is executed by a new shell, so if you change the working directory on one line, it won't have an effect on later lines:
Expand Down

0 comments on commit 8c0bb3d

Please sign in to comment.