The just Command Runner is an Neat Tool
I came across the tool just.
It’s a tool for running commands/scripts.
My initial impression was “that’s it?”.
I might describe it slightly differently, compared to other common workflows:
- It’s common to see
make
used with a bunch of.PHONY:
targets. The point of amake
is to describe how some target is built. But since people will often want to run tasks (e.g. run tests withmake test
), a ‘phony’ target is a task where the target isn’t a file that gets built.- Compared to “use
make
with a bunch of.PHONY
targets”,just
has some nice quality of life features.- e.g. with
just
, you don’t have to indent the definitions using Tabs. - e.g.
just
can list the targets in itsjustfile
.
- e.g. with
- Compared to “use
- In the NodeJS ecosystem, its
package.json
files often contain ascripts
property, which is used to describe common tasks that will be run when working with the project.- Compared to this, a
justfile
is more expressive / less constrained.- e.g. ‘make with
.PHONY
targets’ is more expressive thanpackage.json
’s scripts`.
- e.g. ‘make with
- Compared to this, a
- It’s common to have a ‘script directory’ where you keep a bunch of scripts
for common functionality.
- Compared to this,
just
allows for a consistent starting point, some quality of life features (e.g. by-default always starting scripts with starting directory being thejustfile
’s directory) and allow for integration with editors.
- Compared to this,
Overall, I find that quite persuasive: it’s more polished/tailored than make
for a particular use case; and that use case is something which developers
definitely make use of.
There is the downside that just
isn’t a standard tool that you can hope to
find on most systems (in contrast to e.g. python
, bash
, or maybe awk
or
make
).
But, installing packages isn’t all that hard. (And just
is available in many
places).
And I use nix
, so it’s especially easy to ensure it’s available when I want
it.
I think this is a good example of “sometimes better isn’t MUCH better; it’s merely slightly better”.