Complete recipe parameters and `arg` flags in Zsh
Summary
Please extend the existing Zsh completion support so it can complete recipe-specific parameters, options, and flags from the resolved justfile.
just 1.55.1 already provides Zsh completion scripts via just --completions zsh, and the generated Zsh script delegates to JUST_COMPLETE=zsh just. This request is to make that existing completion path more recipe-aware after a recipe has been selected.
Current behavior
Zsh completion can be installed with:
$ mkdir -p ~/.zsh/completions
$ just --completions zsh > ~/.zsh/completions/_justAnd then enabled in .zshrc with:
fpath=(~/.zsh/completions $fpath)
autoload -U compinit
compinitThis provides completion for just itself and available recipes, but it does not complete the selected recipe's own parameters, options, and flags declared with [arg(...)].
Example
[arg("target", help="Test target")]
[arg("verbose", long="verbose", value="--verbose", help="Use verbose output")]
test target verbose="":
cargo test {{verbose}} {{target}}Expected completion behavior:
$ just <TAB>
test
$ just test --<TAB>
--verbose Use verbose outputRequested behavior
- Complete recipes from the resolved
justfile, using the same justfile discovery behavior as a normaljustinvocation. - After a recipe is selected, complete only the parameters, options, and flags that belong to that recipe.
- Complete long options and flags declared with
[arg(ARG, long="LONG")]. - Complete short options and flags declared with
[arg(ARG, short="S")]. - Include help text from
[arg(ARG, help="HELP")]in Zsh completion descriptions when available. - Support flags declared with
[arg(ARG, long="LONG", value=VALUE)]or[arg(ARG, short="S", value=VALUE)]. - Support options that take values, including repeatable variadic options.
- Avoid suggesting unrelated recipe names where recipe-specific arguments, options, or flags are expected.
Motivation
This would make Zsh completion more useful for justfiles that expose recipes as small command-line interfaces with documented parameters, options, and flags.
Source: casey/just