Skip to content

Add [help] recipe attribute so just <recipe> --help runs just --usage <recipe> #3064

@pygarap

Description

@pygarap

Summary

Add a new recipe attribute, [help], that makes just <recipe> --help print the recipe usage output (same as just --usage <recipe>) and exit, without running the recipe.

Motivation

just --usage <recipe> already generates a useful usage block, including parameter help added via [arg(..., help="...")]. For recipes that are meant to be invoked like small CLIs, it is more natural to support the common pattern just <recipe> --help.

Proposed behavior

Given a recipe marked with [help]:

  • just <recipe> --help behaves exactly like just --usage <recipe>.
  • The recipe body is not executed.
  • Exit code is 0.

If a recipe is not marked with [help], behavior is unchanged.

Example

[help]
[arg("FLAG", long="flag", value="--flag", help="Enable the optional behavior")]
[arg("MODE", long="mode", value="--mode <mode>", help="Select a mode (example: fast, safe)")]
[arg("TARGET", long="target", value="--target <path>", help="Path to operate on")]
do-thing FLAG="" MODE="" TARGET="":
  echo "running with {{FLAG}} {{MODE}} {{TARGET}}"

Expected:

  • just do-thing --help prints the same output as just --usage do-thing, including the help="..." strings from the [arg(...)] annotations.
  • just do-thing --mode fast --target ./src --flag runs the recipe normally.

Compatibility notes

This is opt-in per recipe. Marking a recipe with [help] reserves the literal --help token for usage output for that recipe, rather than treating it as a normal argument value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions