`just` produces detailed error messages and avoids `make`'s idiosyncrasies, so debugging a justfile is easier and less suprising than debugging a makefile.
`just` should run on any system with a reasonable `sh` and can be installed with `cargo`, the [rust language](https://www.rust-lang.org) package manager:
Running `just` with no arguments runs the first recipe in the `justfile`:
```sh
$ just
echo 'This is a recipe!'
This is a recipe!
```
When you invoke `just` it looks for a `justfile` in the current directory and upwards, so you can invoke `just` from any subdirectory of your project.
One or more arguments specify the recipes to run:
```sh
$ just another-recipe
Another recipe.
```
`just` prints each command to standard error before running it, which is why `echo 'This is a recipe!'` was printed. Lines starting with `@` will not be printed which is whyc `echo 'Another recipe.'` was not. printed.
Recipes stop running if a command fails. Here `cargo publish` will only run if `cargo test` succeeds:
Only one recipe that takes arguments may given on the command line, and other recipes may not depend on it. To pass arguments put them after the recipe name:
```sh
$ just build my-awesome-project
Building my-awesome-project...
cd my-awesome-project && make
```
Variables can be exported to recipes as environment variables:
Before `just` was a bloated rust program it was a tiny shell script that called `make`. If you can't or would rather not rust you can find the old version in [extras/just.sh](extras/just.sh).
`just` is a trivial program, but I personally find it very useful to write a `justfile` for almost every project, big or small.
On a big projects with multiple contributers, it's very useful to have a file with all the commands needed to work on the project close at hand.
There are probably different commands to test, build, lint, deploy, and the like, and having them all in one place is useful and cuts down on the time you have to spend telling people which commands to run and how to type them.
And, with an easy place to put commands, it's likely that you'll come up with other useful things which are part of the project's collective wisdom, but which aren't written down anywhere, like the arcane commands needed for some part of your revision control workflow, install all your project's dependencies, or all the random flags you might need to pass to the build system.
Some ideas for recipes:
* Deploying/publishing the project
* Building in release mode vs debug mode
* Running in debug mode or with logging enabled
* Complex git workflows
* Updating dependencies
* Running different sets of tests, for example fast tests vs slow tests, or running them with verbose output
* Any complex set of commands that you really should write down somewhere, if only to be able to remember them
Even for small, personal projects it's nice to be able to remember commands by name instead of `^R`everse searching my shell history, and it is a huge boon to be able to go into an old project written in a random language with a mysterious build system and know that all the commands you need to do whatever you need to do are in the `justfile`, and that if you type `just` something useful (or at least interesting!) will probably happen.
I hope you enjoy using `just`, and find great success and satisfaction in all your computational endeavors!