Skip to main content
Version: 2.22

complete


pants complete [args]

Generates a completion script for the specified shell. The script is printed to stdout.

For example, pants complete --zsh > pants-completions.zsh will generate a zsh completion script and write it to the file my-pants-completions.zsh. You can then source this file in your .zshrc file to enable completion for Pants.

This command is also used by the completion scripts to generate the completion options using passthrough options. This usage is not intended for use by end users, but could be useful for building custom completion scripts.

An example of this usage is in the bash completion script, where we use the following command: pants complete -- ${COMP_WORDS[@]}. This will generate the completion options for the current args, and then pass them to the bash completion script.

Backend: pants.goal

Config section: [complete]

Basic options

shell

--complete-shell=<Shell>
PANTS_COMPLETE_SHELL
pants.toml
[complete]
shell = <Shell>
one of: bash, zsh
default: bash

Which shell completion type should be printed to stdout.

Advanced options

None

Deprecated options

None

None