Shell completions
The DataRobot CLI supports auto-completion for Bash, Zsh, Fish, and PowerShell. Shell completions provide:
- Command and subcommand suggestions.
- Flag and option completions.
- Faster command entry via tab completion.
- Discovery of available commands.
Installation
Automatic installation
You can use three different methods to install shell completions:
-
Installation script: Recommended for first-time installs.
The installer automatically detects your shell and configures completions.
-
Interactive command: Recommended for managing completions.
This command detects your shell and installs completions to the appropriate location.
- Manual installation: Recommended for advanced users. Follow the shell-specific instructions below.
Interactive commands
The CLI provides commands to easily manage completions.
# Install completions for your current shell
dr self completion install
# Force reinstall (useful after updates)
dr self completion install --force
# Uninstall completions
dr self completion uninstall
Manual installation
If you prefer manual installation or the automatic methods do not work, follow the instructions below.
Bash
Linux
# Generate and install the completion script
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Reload your shell
source ~/.bashrc
# If shell completion is not already enabled in your environment you will need
# to enable it. You can execute the following command once:
# echo "autoload -U compinit; compinit" >> ~/.zshrc
# To load completions for each session, execute the following command once:
$ dr self completion zsh > "${fpath[1]}/_dr"
macOS
The default shell in macOS is zsh. Shell completions for zsh
are typically stored in one of the following directories:
/usr/local/share/zsh/site-functions//opt/homebrew/share/zsh/site-functions/${ZDOTDIR:-$HOME}/.zsh/completions/
Run echo $fpath to see all possibilities. For example, if you
wish to put CLI completions into ZDOTDIR, then run:
If you use Bash on macOS, Homebrew stores bash completions in its prefix. If completion does not work after install, check that your shell loads files from:
$(brew --prefix)/etc/bash_completion.d.
Temporary session
For the current session only:
Zsh
Setup
First, ensure completion is enabled in your ~/.zshrc:
Installation
# Create completions directory if it doesn't exist
mkdir -p ~/.zsh/completions
# Generate completion script
dr self completion zsh > ~/.zsh/completions/_dr
# Add to fpath in ~/.zshrc (if not already there)
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
# Reload your shell
source ~/.zshrc
Alternative (using system directory)
# Generate and install the completion script
dr self completion zsh > "${fpath[1]}/_dr"
# Clear completion cache
rm -f ~/.zcompdump
# Reload your shell
source ~/.zshrc
Temporary session
For the current session only:
Fish
# Generate and install the completion script
dr self completion fish > ~/.config/fish/completions/dr.fish
# Reload fish configuration
source ~/.config/fish/config.fish
Temporary session
For the current session only:
PowerShell
Persistent installation
To add the CLI to your PowerShell profile:
# Generate the completion script
dr self completion powershell > dr.ps1
# Find your profile location
echo $PROFILE
# Add the following line to your profile
. C:\path\to\dr.ps1
Alternatively, you can install it directly:
Temporary session
For the current session only:
Usage
Once installed, completions work automatically when you press Tab:
Command completion
# Type 'dr' and press Tab to see all commands
dr <Tab>
# Shows: auth, completion, dotenv, run, templates, version
# Type 'dr auth' and press Tab to see subcommands
dr auth <Tab>
# Shows: check, login, logout, set-url
# Type 'dr templates' and press Tab
dr templates <Tab>
# Shows: clone, list, setup, status
Flag completion
# Type a command and -- then Tab to see flags
dr run --<Tab>
# Shows: --concurrency, --dir, --exit-code, --help, --list, --parallel, --silent, --watch, --yes
# Partial flag matching works too
dr run --par<Tab>
# Completes to: dr run --parallel
Argument completion
For commands that support it:
# Template names when using setup
dr templates setup <Tab>
# Shows available template names from DataRobot
# Task names when using run (if in a template directory)
dr run <Tab>
# Shows available tasks from Taskfile
Verification
Test that completions are working:
# Try command completion
dr te<Tab>
# Should complete to: dr templates
# Try flag completion
dr run --l<Tab>
# Should complete to: dr run --list
Troubleshooting
Completions not working
Bash
Important: Bash completions require the bash-completion package to be installed first.
- Install bash-completion if not already installed:
# macOS (Homebrew)
brew install bash-completion@2
# Ubuntu/Debian
sudo apt-get install bash-completion
# RHEL/CentOS
sudo yum install bash-completion
- Check that bash-completion is loaded:
- Verify completion script location:
- Check
.bashrcsources completion:
- Reload your shell:
Zsh
-
Verify
compinitis in~/.zshrc: -
Check completion file location:
-
Clear completion cache:
-
Reload Zsh:
Fish
-
Check that the completion file exists:
-
Verify that Fish recognizes it:
-
Reload Fish:
PowerShell
- Check execution policy:
If it's Restricted, change it:
-
Verify profile loads completion:
-
Reload profile:
Permission denied
If you get permission errors when installing:
# Use sudo for system-wide installation
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Or use user-level installation
dr self completion bash > ~/.bash_completions/dr
source ~/.bash_completions/dr
Completion cache issues
For Zsh, if completions are outdated:
Advanced configuration
Custom completion behavior
You can customize how completions work by modifying the generated script.
For example, in the Bash completion script, you can add custom completion logic:
dr self completion bash > ~/dr-completion.bash
vim ~/dr-completion.bash
# Source it in your .bashrc
source ~/dr-completion.bash
Multiple shell support
If you use multiple shells, install completions for each:
dr self completion bash > ~/.bash_completions/dr
dr self completion zsh > ~/.zsh/completions/_dr
dr self completion fish > ~/.config/fish/completions/dr.fish
Updating completions
When the CLI is updated, regenerate completions:
# Bash
dr self completion bash | sudo tee /etc/bash_completion.d/dr
# Zsh
dr self completion zsh > ~/.zsh/completions/_dr
rm -f ~/.zcompdump
# Fish
dr self completion fish > ~/.config/fish/completions/dr.fish
# PowerShell
dr self completion powershell >> $PROFILE
See also
- Quick start—get started with the CLI.
- Command reference—browse commands and flags.
- Cobra documentation—completion implementation details.