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.
Summary
Add a new recipe attribute,
[help], that makesjust <recipe> --helpprint the recipe usage output (same asjust --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 patternjust <recipe> --help.Proposed behavior
Given a recipe marked with
[help]:just <recipe> --helpbehaves exactly likejust --usage <recipe>.If a recipe is not marked with
[help], behavior is unchanged.Example
Expected:
just do-thing --helpprints the same output asjust --usage do-thing, including thehelp="..."strings from the[arg(...)]annotations.just do-thing --mode fast --target ./src --flagruns the recipe normally.Compatibility notes
This is opt-in per recipe. Marking a recipe with
[help]reserves the literal--helptoken for usage output for that recipe, rather than treating it as a normal argument value.