Shell Completion
Set up autocompletion for Vandor CLI commands in your shell
Shell Completion
Vandor CLI provides intelligent autocompletion for all commands, subcommands, and flags. This guide shows you how to set it up for your shell.
What You Get
With shell completion enabled, you can:
- Tab-complete commands: Type
vandor <TAB>to see all available commands - Tab-complete subcommands: Type
vandor vpkg <TAB>to see vpkg actions - Tab-complete flags: Type
vandor add --<TAB>to see all flags - Context-aware suggestions: Different completions based on command position
- Partial matching: Type
van<TAB>to complete tovandor
Quick Setup
Zsh (Recommended)
With Oh-My-Zsh:
# Install completion
vandor completion zsh > ~/.oh-my-zsh/completions/_vandor
# Restart shell
exec zshStandard Zsh:
# Create completions directory
mkdir -p ~/.zsh/completions
# Install completion
vandor completion zsh > ~/.zsh/completions/_vandor
# Add to ~/.zshrc (if not already there)
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrc
# Restart shell
exec zshSystem-wide (requires sudo):
sudo vandor completion zsh > /usr/local/share/zsh/site-functions/_vandor
exec zshBash
User installation:
# Create completions directory
mkdir -p ~/.local/share/bash-completion/completions
# Install completion
vandor completion bash > ~/.local/share/bash-completion/completions/vandor
# Restart shell
exec bashSession-based (add to ~/.bashrc):
# Add to ~/.bashrc
echo 'source <(vandor completion bash)' >> ~/.bashrc
# Reload
source ~/.bashrcFish
# Install completion
vandor completion fish > ~/.config/fish/completions/vandor.fish
# Restart shell or reload
exec fishPowerShell
# Add to your PowerShell profile
Add-Content -Path $PROFILE -Value 'vandor completion powershell | Out-String | Invoke-Expression'
# Reload profile
. $PROFILETesting Completion
After installation, test that completion works:
# Test main commands
vandor <TAB>
# Should show: add, completion, dev:app, dev:worker, new, run:app, run:worker,
# sync, theme, tui, upgrade, version, vpkg
# Test vpkg subcommands
vandor vpkg <TAB>
# Should show: add, doctor, exec, exec-alias, info, list, registry, remove, search, sync
# Test component types
vandor add <TAB>
# Should show: context, domain, service, usecase, valueobject
# Test flags
vandor vpkg add --<TAB>
# Should show: --allow-target, --plan, --yes
# Test package names (if you have used vpkg before)
vandor vpkg add <TAB>
# Should show: @official/http-humachi, @official/entgo, etc.Troubleshooting
Completion Not Working
Zsh:
# Check if compinit is loaded
echo $fpath | grep -o '[^ ]*completions[^ ]*'
# Force rebuild completion cache
rm -f ~/.zcompdump
compinitBash:
# Check if bash-completion is installed
if [ -f /etc/bash_completion ]; then
echo "bash-completion is installed"
fi
# Reload bash completion
source /etc/bash_completionFish:
# Reload completions
fish_update_completionsCompletion File Not Found
Make sure the Vandor binary is in your PATH:
which vandor
# Should show: /usr/local/bin/vandor or similar
# If not found, add to PATH or use full path:
/path/to/vandor completion zsh > ~/.oh-my-zsh/completions/_vandorOutdated Completions
After upgrading Vandor CLI, regenerate completions:
# Zsh (oh-my-zsh)
vandor completion zsh > ~/.oh-my-zsh/completions/_vandor
exec zsh
# Bash
vandor completion bash > ~/.local/share/bash-completion/completions/vandor
exec bash
# Fish
vandor completion fish > ~/.config/fish/completions/vandor.fish
exec fishNote: vandor upgrade automatically regenerates completions if they were installed in standard locations.
Advanced Usage
Multiple Shell Support
If you use multiple shells, set up completion for each:
# Zsh
vandor completion zsh > ~/.oh-my-zsh/completions/_vandor
# Bash
vandor completion bash > ~/.local/share/bash-completion/completions/vandor
# Fish
vandor completion fish > ~/.config/fish/completions/vandor.fishCustom Completion Directory
# Zsh - custom directory
mkdir -p ~/my-completions
vandor completion zsh > ~/my-completions/_vandor
# Add to ~/.zshrc
echo 'fpath=(~/my-completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrcCI/CD Environment
For CI/CD environments, you can generate completion on-the-fly:
# In your script
source <(vandor completion bash)
# Now use vandor with completionCompletion Behavior
Command Completion
The completion system understands Vandor's command structure:
vandor <TAB> # Main commands
vandor add <TAB> # Component types (context, domain, usecase, service, valueobject)
vandor vpkg <TAB> # VPKG actions
vandor vpkg add <TAB> # Package names (from registry)Flag Completion
Flags are completed with descriptions:
vandor new --<TAB>
# Shows:
# --module Go module path
# --tidy When to run go mod tidy
# --interactive Enable interactive mode
# --output Output formatContext-Aware
Completion changes based on context:
# After 'add', shows component types
vandor add <TAB>
# After 'vpkg add', shows package names
vandor vpkg add <TAB>
# After flags, shows appropriate values
vandor new --tidy <TAB> # Shows: auto, always, neverSee Also
- Installation Guide - Install Vandor CLI
- CLI Reference - Full command reference
- Upgrade Guide - Upgrade Vandor CLI