Recipe Attributes

Recipes may be annotated with attributes that change their behavior.

[confirm]1.17.0Require confirmation prior to executing recipe.
[confirm("prompt")]1.23.0Require confirmation prior to executing recipe with a custom prompt.
[linux]1.8.0Enable recipe on Linux.
[macos]1.8.0Enable recipe on MacOS.
[no-cd]1.9.0Don’t change directory before executing recipe.
[no-exit-message]1.7.0Don’t print an error message if recipe fails.
[no-quiet]1.23.0Override globally quiet recipes and always echo out the recipe.
[private]1.10.0See Private Recipes.
[unix]1.8.0Enable recipe on Unixes. (Includes MacOS).
[windows]1.8.0Enable recipe on Windows.

A recipe can have multiple attributes, either on multiple lines:

    echo "foo"

Or separated by commas on a single line1.14.0:

[no-cd, private]
    echo "foo"

Enabling and Disabling Recipes1.8.0

The [linux], [macos], [unix], and [windows] attributes are configuration attributes. By default, recipes are always enabled. A recipe with one or more configuration attributes will only be enabled when one or more of those configurations is active.

This can be used to write justfiles that behave differently depending on which operating system they run on. The run recipe in this justfile will compile and run main.c, using a different C compiler and using the correct output binary name for that compiler depending on the operating system:

  cc main.c

  cl main.c

Disabling Changing Directory1.9.0

just normally executes recipes with the current directory set to the directory that contains the justfile. This can be disabled using the [no-cd] attribute. This can be used to create recipes which use paths relative to the invocation directory, or which operate on the current directory.

For example, this commit recipe:

commit file:
  git add {{file}}
  git commit

Can be used with paths that are relative to the current directory, because [no-cd] prevents just from changing the current directory when executing commit.

Requiring Confirmation for Recipes1.17.0

just normally executes all recipes unless there is an error. The [confirm] attribute allows recipes require confirmation in the terminal prior to running. This can be overridden by passing --yes to just, which will automatically confirm any recipes marked by this attribute.

Recipes dependent on a recipe that requires confirmation will not be run if the relied upon recipe is not confirmed, as well as recipes passed after any recipe that requires confirmation.

  rm -rf *

Custom Confirmation Prompt1.23.0

The default confirmation prompt can be overridden with [confirm(PROMPT)]:

[confirm("Are you sure you want to delete everything?")]
  rm -rf *