Tab Completion¶
The Fabric CLI (fab) supports comprehensive tab completion in command_line mode for commands, subcommands, and flags to enhance productivity. This feature provides auto-completion suggestions as you type, reducing the need to memorize command syntax.
Current Limitations and Support¶
The tab completion feature currently supports the following functionality:
- Command Completion - Auto-complete group commands (e.g.,
fab <Tab>) - Subcommand Completion - Auto-complete subcommands for each command (e.g.,
fab acl <Tab>) - Flag Completion - Auto-complete available flags and options (e.g.,
fab acl --<Tab>) - Config Key Completion - Auto-complete keys for
config getandconfig setcommands (e.g.,fab config get <Tab>)
Shell Support¶
Tab completion is supported in the following shell environments:
- PowerShell (Windows PowerShell and PowerShell Core)
- Bash (Linux/macOS and Windows Subsystem for Linux)
- Zsh (Z shell - popular on macOS and Linux)
How to Enable Autocompletion¶
To enable fab tab completion, follow the instructions for your shell.
The completion scripts are also available in the scripts/completion directory of the repository.
PowerShell¶
- Create or edit your PowerShell profile. You can open it by running
notepad $PROFILE. - Refer to the script
fab_completion.ps1and add it to your profile. - Restart your terminal or run
. $PROFILEto apply the changes.
Zsh¶
- Open your Zsh profile (
~/.zshrc) in a text editor. -
Add the following line:
-
Restart your terminal or run
source ~/.zshrcto apply the changes.
Bash¶
- Open your Bash profile (
~/.bashrc) in a text editor. -
Add the following line:
-
Restart your terminal or run
source ~/.bashrcto apply the changes.