This adds autogenerated shell completions to various shells.
The completions are generated per installation. It does so
by writing a complete CLI tree to $TAPDIR/.tap-completions.json
whenever a package is added to or removed from an installation,
or if the completion is invoked and the file is missing.
The autocompletion hooks support multiple different OpenTAP installations, and will provide contextual completions based on which binary is being used in the invocation. Completions will only work if this plugin is installed in the installation currently being invoked.
This is possible because OpenTAP encourages developers to annotate their code with documentation in many instances, including the names and properties of CLI actions.
Currently, only zsh is supported. Support for bash and powershell is hopefully coming soon! zsh and bash will require python for some json parsing, but powershell will not have any dependencies.
One time in the current shell:
# source the completions
source `./packages/ShellCompletion/zsh/_tap`
# manually configure the completion hook
compdef _tap tap
To automatically load the completions on shell startup, copy ./zsh/_tap
to some directory in your fpath
.
source `./packages/ShellCompletion/powershell/_tap.ps1`
- TBD