Generate shell completion scripts for command auto-completion.
For most users, setting up shell completion is a single command:
# Generate and install completion for your shell
# Bash (Linux)
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Zsh
dr self completion zsh > "${fpath[1]}/_dr"
# Fish
dr self completion fish > ~/.config/fish/completions/dr.fishAfter installation, reload your shell to activate completions.
Note
First time? If you're new to the CLI, start with the Quick start for step-by-step setup instructions.
# Generate script for a shell (redirect to install)
dr self completion <shell>
# Interactive install or uninstall
dr self completion install [shell]
dr self completion uninstall [shell]Supported shells: bash, zsh, fish, powershell.
The self completion command generates shell completion scripts that enable auto-completion for the DataRobot CLI. You can either pass a shell name to output a script (then redirect to a file or pipe as needed), or use the install and uninstall subcommands for interactive setup. Completions provide command, subcommand, and flag suggestions when you press Tab.
bash—Bourne Again Shell.zsh—Z Shell.fish—Friendly Interactive Shell.powershell—PowerShell.
For interactive setup without manually choosing paths:
dr self completion install [shell]—detects your shell (or use optionalbash,zsh,fish,powershell), generates the script, and writes it to the appropriate location for your OS. Use--forceto overwrite existing files.dr self completion uninstall [shell]—removes previously installed completion files.
See the Shell completions guide for step-by-step instructions.
Linux:
# Install system-wide
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Reload shell
source ~/.bashrcmacOS:
# Install via Homebrew's bash-completion
brew install bash-completion@2
dr self completion bash > $(brew --prefix)/etc/bash_completion.d/dr
# Reload shell
source ~/.bash_profileTemporary (current session only):
source <(dr self completion bash)Setup:
First, ensure completion is enabled:
# Add to ~/.zshrc if not present
autoload -U compinit
compinitInstallation:
# Option 1: User completions directory
mkdir -p ~/.zsh/completions
dr self completion zsh > ~/.zsh/completions/_dr
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
# Option 2: System directory
dr self completion zsh > "${fpath[1]}/_dr"
# Clear cache and reload
rm -f ~/.zcompdump
source ~/.zshrcTemporary (current session only):
source <(dr self completion zsh)# Install completion
dr self completion fish > ~/.config/fish/completions/dr.fish
# Reload Fish
source ~/.config/fish/config.fishTemporary (current session only):
dr self completion fish | sourcePersistent:
# Generate completion script
dr self completion powershell > dr.ps1
# Add to PowerShell profile
Add-Content $PROFILE ". C:\path\to\dr.ps1"
# Reload profile
. $PROFILETemporary (current session only):
dr self completion powershell | Out-String | Invoke-Expression# View the generated script
dr self completion bash
# Save to a file
dr self completion bash > dr-completion.bash
# Save for all shells
dr self completion bash > dr-completion.bash
dr self completion zsh > dr-completion.zsh
dr self completion fish > dr-completion.fish
dr self completion powershell > dr-completion.ps1If you use multiple shells:
# Bash
dr self completion bash > ~/.bash_completions/dr
# Zsh
dr self completion zsh > ~/.zsh/completions/_dr
# Fish
dr self completion fish > ~/.config/fish/completions/dr.fishAfter updating the CLI:
# Bash
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Zsh
dr self completion zsh > ~/.zsh/completions/_dr
rm -f ~/.zcompdump
exec zsh
# Fish
dr self completion fish > ~/.config/fish/completions/dr.fish$ dr <Tab>
auth completion dotenv run templates version
$ dr auth <Tab>
check login logout set-url
$ dr templates <Tab>
list setup$ dr run --<Tab>
--concurrency --dir --exit-code --help
--list --parallel --silent --watch
--yes
$ dr --<Tab>
--debug --help --verboseSome commands support argument completion:
# Task names (when in a template directory)
$ dr run <Tab>
build dev deploy lint testBash:
-
Verify bash-completion is installed:
# macOS brew list bash-completion@2 # Linux dpkg -l | grep bash-completion
-
Check if completion script exists:
ls -l /etc/bash_completion.d/dr
-
Ensure .bashrc sources completions:
grep bash_completion ~/.bashrc -
Reload shell:
source ~/.bashrc
Zsh:
-
Verify compinit is called:
grep compinit ~/.zshrc -
Check fpath includes completion directory:
echo $fpath
-
Clear completion cache:
rm -f ~/.zcompdump* compinit
-
Reload shell:
exec zsh
Fish:
-
Check completion file:
ls -l ~/.config/fish/completions/dr.fish -
Verify Fish recognizes it:
complete -C dr -
Reload Fish:
source ~/.config/fish/config.fish
PowerShell:
-
Check execution policy:
Get-ExecutionPolicyIf restricted:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
-
Verify profile loads completion:
cat $PROFILE -
Reload profile:
. $PROFILE
Use user-level installation instead of system-wide:
# Bash - user level
mkdir -p ~/.bash_completions
dr self completion bash > ~/.bash_completions/dr
echo 'source ~/.bash_completions/dr' >> ~/.bashrc
# Zsh - user level
mkdir -p ~/.zsh/completions
dr self completion zsh > ~/.zsh/completions/_dr
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrcAfter updating the CLI, regenerate completions:
# Bash
dr self completion bash | sudo tee /etc/bash_completion.d/dr
source ~/.bashrc
# Zsh
dr self completion zsh > ~/.zsh/completions/_dr
rm -f ~/.zcompdump
exec zsh
# Fish
dr self completion fish > ~/.config/fish/completions/dr.fishCompletions are context-aware:
# Only shows valid subcommands
dr auth <Tab>
# Shows: check login logout set-url (not other commands)
# Only shows valid flags
dr run --l<Tab>
# Shows: --list (not all flags)In Fish and PowerShell, completions include descriptions:
$ dr templates <Tab>
list (List available templates)
setup (Interactive template setup wizard)Some completions are generated dynamically:
# Task names from current Taskfile
dr run <Tab>
# Available shells
dr self completion <Tab>You can extend or modify generated completions:
# Generate base completion
dr self completion bash > ~/dr-completion-custom.bash
# Edit to add custom logic
vim ~/dr-completion-custom.bash
# Source your custom version
source ~/dr-completion-custom.bashFor faster completions, especially with dynamic suggestions:
# Cache template list
dr templates list > ~/.dr-templates-cache
# Use cached list in custom completion script- Shell completion guide—detailed setup instructions.
- Quick start—initial setup.
- Command completion is powered by Cobra.