Use the cobra library to generate shell completion scripts for Bash, Zsh, and Fish by running the completion command for each shell. Add the generated script to your shell's configuration directory and source it to enable completions.
# Generate and install Bash completion
mycli completion bash > /etc/bash_completion.d/mycli
# Generate and install Zsh completion
mycli completion zsh > /usr/local/share/zsh/site-functions/_mycli
# Generate and install Fish completion
mycli completion fish > ~/.config/fish/completions/mycli.fish
Restart your terminal or run source on the config file to apply changes.