Shell autocompletion

Commodore supports command and cluster autocompletion. Command autocompletion shows possible completion for partially typed Commodore subcommands and command-line flags. Command autocompletion is provided by the Click Python library. Cluster autocompletion is enabled for commodore catalog compile. This relies on a custom completion implementation in Commodore which fetches the list of known clusters from the provided Lieutenant API to show possible completions.

This only works when Commodore is installed locally due to limitations on how shell completion is implemented in the Click Python library. See Running Commodore for details on how to install Commodore locally.

Click supports autocompletion for the bash, zsh and fish shells.

To enable autocompletion for your local Commodore installation, follow the steps below.

  1. Add the following snippet in your shell’s configuration

    bash (~/.bashrc)
    source <(_COMMODORE_COMPLETE=bash_source commodore)
    zsh (~/.zshrc)
    source <(_COMMODORE_COMPLETE=zsh_source commodore)
    fish (~/.config/fish/completions/commodore.fish)
    source <(_COMMODORE_COMPLETE=fish_source commodore)
  2. Reload your shell’s configuration or start a new shell in order for the changes to be loaded

See the Click documentation for more details on how-to setup autocompletion.