Manage and build code

Save and run project-specific commands with the just command runner

just just-crates.io just-github just-lib.rs cat-development-tools cat-command-line-utilities

just is a command runner. It is a Rust-based equivalent to make without the ability to detect file changes, but with significantly fewer syntactic warts.

Consult the Just programmer's manual⮳.

Create a justfile

Place the following example justfile in the root folder of your project. Run just to see a list of recipes. Run just <recipe> to execute the corresponding recipe.

# Load a .env file, if present.
set dotenv-load

default:
 @just --list --unsorted

# Check a local package and all of its dependencies for errors
check:
 @cargo check

# Compile a local package and all of its dependencies
build: check
 @cargo build

# Run a binary or example of the local packagels
run: check
 @cargo run

system-info:
 @echo "This is an {{arch()}} machine".

# Shebang script example
foo:
 #!/usr/bin/env bash
 set -euxo pipefail
 hello='Yo'
 echo "$hello from Bash!"

Install just in a Dev Container

FROM mcr.microsoft.com/devcontainers/base:bullseye
# or perhaps mcr.microsoft.com/devcontainers/rust:bullseye if you want rust & cargo

SHELL ["bash", "-c"]

# Prerequisites to install Just: https://just.systems/man/en
RUN <<EOF
 wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
 echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
 sudo apt update
EOF

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
  && apt-get -y install just \
  && apt-get autoremove -y && apt-get clean -y

For Alpine, use apk⮳:

RUN apk add just

Check your Rust code in the background

bacon bacon-crates.io bacon-github bacon-lib.rs cat-development-tools cat-command-line-utilities

bacon is a background rust code checker. It is designed for minimal interaction, so that you can just let it run, alongside your editor, and be notified of warnings, errors, or test failures in your Rust code.

# Install or update `bacon`
cargo install --locked bacon

# Check the current project
bacon

# Run clippy instead of cargo check
bacon clippy