How to Enable Shell Completion
This guide shows how to enable shell auto-completion for blobber commands, flags, image tags, and file paths.
What You Get
Once enabled, pressing Tab will complete:
- Commands and subcommands:
blobber pu<TAB>→blobber push - Flags:
blobber push --com<TAB>→blobber push --compression - Image tags:
ghcr.io/org/repo:<TAB>→ suggests available tags from the registry - File paths in images:
blobber cat ghcr.io/org/repo:v1 conf<TAB>→ suggests matching files
Bash
Prerequisites
Install the bash-completion package:
# macOS
brew install bash-completion
# Debian/Ubuntu
sudo apt install bash-completion
# Fedora/RHEL
sudo dnf install bash-completion
Enable Completion
For the current session:
source <(blobber completion bash)
For all future sessions:
# macOS (Homebrew)
blobber completion bash > $(brew --prefix)/etc/bash_completion.d/blobber
# Linux
blobber completion bash > /etc/bash_completion.d/blobber
Restart your shell or run source ~/.bashrc.
Zsh
Prerequisites
Ensure completion is enabled in your ~/.zshrc:
echo "autoload -U compinit; compinit" >> ~/.zshrc
Enable Completion
For the current session:
source <(blobber completion zsh)
For all future sessions:
# macOS (Homebrew)
blobber completion zsh > $(brew --prefix)/share/zsh/site-functions/_blobber
# Linux
blobber completion zsh > "${fpath[1]}/_blobber"
Restart your shell.
Fish
For the current session:
blobber completion fish | source
For all future sessions:
blobber completion fish > ~/.config/fish/completions/blobber.fish
Restart your shell.
PowerShell
For the current session:
blobber completion powershell | Out-String | Invoke-Expression
For all future sessions:
Add the above command to your PowerShell profile. To find your profile path:
echo $PROFILE
Disabling Descriptions
By default, completions include helpful descriptions. To disable them:
blobber completion bash --no-descriptions > /path/to/completion
Troubleshooting
Completions not appearing
- Ensure you restarted your shell after setup
- Verify the completion file exists in the correct location
- For bash, ensure
bash-completionis installed and sourced
Tag completion is slow
Tag lists are fetched from the registry on first use. They're cached for 30 seconds to speed up subsequent completions. If your registry is slow, completions may take a moment on first access.
Tag completion requires authentication
If your registry requires authentication, ensure you're logged in:
docker login ghcr.io
See How to Authenticate for details.
See Also
- blobber completion - Command reference
- How to Authenticate - Registry authentication