Skip to content

Task Syntax

github-actions[bot] edited this page Sep 9, 2026 · 1 revision

Task Syntax

A Runefile consists of metadata attributes, task signatures, and indented command bodies.

#[Task description]
#[confirm: Confirmation prompt]
task_name [arguments...] [--flags...] [*passthrough] : [dependencies...]
    command 1
    command 2
Element Description
#[...] Metadata — attaches description or safety prompt to the next task
# Comment — ignored entirely
Signature Non-indented line ending with : (or : dep1 dep2)
Commands Lines indented with 4 spaces or a tab
{{var}} Interpolation — expands to the resolved argument or flag value

Arguments

Arguments belong directly in the task signature.

Required Positional Arguments

greet name:
    echo "Hello, {{name}}!"
rune greet Supian
# Output: Hello, Supian!

If a required argument is omitted, Rune displays an actionable error:

✗ Missing argument: name

Usage:
  rune greet <name>

Default Arguments

Assign a default value using = (supports quoted or unquoted values):

build target="dev":
    echo "Building for target: {{target}}"
rune build
# Output: Building for target: dev

rune build production
# Output: Building for target: production

Note: Required arguments must always precede default arguments in the signature.


Flags

Declare optional boolean flags using --<name>?:

build target="dev" --race?:
    go build {{race}} ./...
rune build
rune build --race
rune build production --race

When --race is passed, {{race}} expands to --race. When omitted, it expands to nothing.

Typos & Suggestions

If you mistype a flag, Rune calculates edit distance and suggests the intended option:

rune build --rce
✗ Unknown option: --rce

Did you mean:
  --race

Passthrough Arguments (*args)

When an underlying tool accepts arbitrary arguments or flags, declare an explicit passthrough parameter using *<name> (conventionally *args):

#[Forward arbitrary commands to Docker Compose]
compose *args:
    docker compose {{args}}
rune compose exec api sh -c "echo 'Health check'" --user=root

The underlying command receives each argument and flag intact — quotation marks remain a single discrete argument and unknown flags are not forwarded unless *args is explicitly declared.


Interactive TTY & REPL Passthrough

Rune attaches the child process directly to your terminal's stdin, stdout, and stderr:

  • Interactive Tools: Commands like bash, python, psql, ssh, vim, or htop run natively.
  • Arrow Keys & Shortcuts: Interactive navigation and control keys work out-of-the-box.
  • Signal Forwarding: SIGINT (Ctrl+C), SIGTERM, and SIGHUP are forwarded to child processes.
  • Exit Code Preservation: The exact exit code of the underlying command is propagated back to your shell.

Stream Piping

Tasks seamlessly participate in standard Unix pipes:

cat dump.sql | rune db:import
rune compose ps | grep running

Clone this wiki locally