docs/Shell-Completions.md
Fabric comes with shell completion support for Zsh, Bash, and Fish shells. These completions provide intelligent tab-completion for commands, flags, patterns, models, contexts, and more.
You can install completions without cloning the repo:
# No-clone install (Zsh/Bash/Fish supported)
curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh | sh
# Optional: dry-run first
curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh | sh -s -- --dry-run
# Optional: override the download source
FABRIC_COMPLETIONS_BASE_URL="https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions" \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh)"
Or, if you have the repository locally:
# Run the automated setup script from a cloned repo
./completions/setup-completions.sh
# Or see what it would do first
./completions/setup-completions.sh --dry-run
The script will:
fabric or fabric-ai installed$fpath directories (for zsh) or standard completion directoriesIf the completion files aren't present locally (e.g., when running via curl), the script will automatically download them from GitHub.
For manual installation or troubleshooting, see the detailed instructions below.
Copy the completion file to a directory in your $fpath:
sudo cp completions/_fabric /usr/local/share/zsh/site-functions/
Important: If you installed fabric as fabric-ai, create a symlink so completions work:
sudo ln -s /usr/local/share/zsh/site-functions/_fabric /usr/local/share/zsh/site-functions/_fabric-ai
Restart your shell or reload completions:
autoload -U compinit && compinit
Copy the completion file to a standard completion directory:
# System-wide installation
sudo cp completions/fabric.bash /etc/bash_completion.d/
# Or user-specific installation
mkdir -p ~/.local/share/bash-completion/completions/
cp completions/fabric.bash ~/.local/share/bash-completion/completions/fabric
Important: If you installed fabric as fabric-ai, create a symlink:
# For system-wide installation
sudo ln -s /etc/bash_completion.d/fabric.bash /etc/bash_completion.d/fabric-ai.bash
# Or for user-specific installation
ln -s ~/.local/share/bash-completion/completions/fabric ~/.local/share/bash-completion/completions/fabric-ai
Restart your shell or source the completion:
source ~/.bashrc
Copy the completion file to Fish's completion directory:
mkdir -p ~/.config/fish/completions
cp completions/fabric.fish ~/.config/fish/completions/
Important: If you installed fabric as fabric-ai, create a symlink:
ln -s ~/.config/fish/completions/fabric.fish ~/.config/fish/completions/fabric-ai.fish
Fish will automatically load the completions (no restart needed).
The completions provide intelligent suggestions for:
-p or --pattern-m or --model--voiceYou can also source the completion files directly in your shell's configuration file:
~/.zshrc: source /path/to/fabric/completions/_fabric~/.bashrc: source /path/to/fabric/completions/fabric.bash$fpathThe completion system dynamically queries the fabric command for current patterns, models, and other resources, so your completions will always be up-to-date with your fabric installation.