Project-specific commands with just

2021-07-31 2 min read

Every project has its own specific requirements. Most of the time, we can meet this need with commands. But when it comes to writing and running commands, sometimes shell scripts can be a bit low level.

This is where just handles the situation better. It functions as an abstract layer between your shell and the project and helps you run commands in a handy way. You can think of it like Makefile. But unlike Makefile, just files are more readable and easier to write.

Installation

You can find OS-specific installation instructions on its GitHub page.

A sample justfile

The configuration files for the just tool are named justfile by default. Below is an example justfile:

justfile
test:
  echo 'Testing!'

build target:
  @echo 'Building {{target}}...'
  cd {{target}} && make

In the above example, there's the test and build commands. You can pass a target parameter to the build command. Did you notice the @ character in the @echo statement? just prints each command to standard error before running it. This is suppressed for lines starting with @.

$ just test
echo 'Testing!'
Testing!

More...

It's better not to get into giving more examples as it has too many features. You can check it out on its GitHub repo by clicking on here.

Date: 2021-07-31
Tags: just