Shell Completion
Shell completion lets your shell finish lnk commands, their flags,
and a flag's values when you press Tab, each shown with its help in zsh.
Turn It On
In bash 4 or later, source the bash script from ~/.bashrc:
source ~/link/scripts/completion/lnk.bashIn zsh, source the zsh script from ~/.zshrc, after compinit runs:
source ~/link/scripts/completion/lnk.zshBoth paths assume a copy of this repository in ~/link. Each script is
one file, so a copy of it anywhere works the same way.
What Completes
Each command a published module offers a person on the command line
completes, word by word, from lnk through its resource and verb. After
a command, Tab offers its runtime flags and, for a command that reads a
spec, --spec and its field flags. A flag whose values are a closed
set, such as --model.anthropic.thinking, completes to those values.
Plumbing commands, which other programs run, are left out.
How It's Made
The scripts are generated, never written by hand. The
link-actions-surfaces
completion generator reads the catalog of every module's declarations,
the same one lnk's parsers and help come from. A command's runtime
flags come from its declared arguments, and its field flags from its
bound spec, as its help lists them. The docs check refuses a script
that is absent, stale, or edited by hand, and lnk-docs-inventories --write writes it again from the declarations.