feat(juju): add native zsh completion

Add _juju: native zsh completion script replacing bash-completion
sourcing; supports subcommand, flag, model, and controller tab
completion including "controller:model" format
This commit is contained in:
Iyigun Cevik 2026-04-03 18:01:20 +02:00
commit 806f1a0ed3
No known key found for this signature in database
GPG key ID: 254FDC0AD54E6E84
2 changed files with 244 additions and 6 deletions

View file

@ -3,12 +3,14 @@
# ---------------------------------------------------------- #
# Load TAB completions
# You need juju's bash completion script installed. By default bash-completion's
# location will be used (i.e. pkg-config --variable=completionsdir bash-completion).
completion_file="$(pkg-config --variable=completionsdir bash-completion 2>/dev/null)/juju" || \
completion_file="/usr/share/bash-completion/completions/juju"
[[ -f "$completion_file" ]] && source "$completion_file"
unset completion_file
source "${0:A:h}/_juju"
# group-name '' enables visual separation between completion groups (e.g. models
# vs controllers in juju switch <TAB>). This is a safe global setting that
# improves completion display for all commands.
zstyle ':completion:*' group-name ''
# Show group headers only for juju completions.
zstyle ':completion::complete:juju:*' format '%B%d%b'
# ---------------------------------------------------------- #
# Aliases (in alphabetic order) #