# Shell completions

> Shell completions - The DataRobot CLI supports auto-completion for Bash, Zsh, Fish, and PowerShell.
> Shell completions provide:

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-05-06T18:17:09.551441+00:00` (UTC).

## Primary page

- [Shell completions](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html): Full documentation for this topic (HTML).

## Sections on this page

- [Installation](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#installation): In-page section heading.
- [Automatic installation](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#automatic-installation): In-page section heading.
- [Interactive commands](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#interactive-commands): In-page section heading.
- [Manual installation](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#manual-installation): In-page section heading.
- [Bash](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#bash): In-page section heading.
- [Linux](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#linux): In-page section heading.
- [macOS](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#macos): In-page section heading.
- [Temporary session](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#temporary-session): In-page section heading.
- [Zsh](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#zsh): In-page section heading.
- [Setup](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#setup): In-page section heading.
- [Installation](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#installation-zsh): In-page section heading.
- [Alternative (using system directory)](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#alternative-zsh): In-page section heading.
- [Fish](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#fish): In-page section heading.
- [PowerShell](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#powershell): In-page section heading.
- [Persistent installation](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#persistent-installation): In-page section heading.
- [Usage](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#usage): In-page section heading.
- [Command completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#command-completion): In-page section heading.
- [Flag completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#flag-completion): In-page section heading.
- [Argument completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#argument-completion): In-page section heading.
- [Verification](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#verification): In-page section heading.
- [Troubleshooting](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#troubleshooting): In-page section heading.
- [Completions not working](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#completions-not-working): In-page section heading.
- [Bash](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#bash-troubleshooting): In-page section heading.
- [Zsh](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#zsh-troubleshooting): In-page section heading.
- [Fish](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#fish-troubleshooting): In-page section heading.
- [PowerShell](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#powershell-troubleshooting): In-page section heading.
- [Permission denied](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#permission-denied): In-page section heading.
- [Completion cache issues](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#completion-cache-issues): In-page section heading.
- [Advanced configuration](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#advanced-configuration): In-page section heading.
- [Custom completion behavior](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#custom-completion-behavior): In-page section heading.
- [Multiple shell support](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#multiple-shell-support): In-page section heading.
- [Updating completions](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#updating-completions): In-page section heading.
- [See also](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html#see-also): In-page section heading.

## Related documentation

- [Agentic AI](https://docs.datarobot.com/en/docs/agentic-ai/index.html): Linked from this page.
- [CLI](https://docs.datarobot.com/en/docs/agentic-ai/cli/index.html): Linked from this page.
- [Getting started setup guide](https://docs.datarobot.com/en/docs/agentic-ai/cli/getting-started.html): Linked from this page.
- [Command reference](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/index.html): Linked from this page.

## Documentation content

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:

1. Installation script: Recommended for first-time installs. The installer automatically detects your shell and configures completions.

```
curl -fsSL https://raw.githubusercontent.com/datarobot-oss/cli/main/install.sh | sh
```

1. Interactive command: Recommended for managing completions. This command detects your shell and installs completions to the appropriate location.

```
dr self completion install
```

1. 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:

```
dr self completion zsh > ${ZDOTDIR:-$HOME}/.zsh/completions/_dr
```

#### Temporary session

For the current session only:

```
source <(dr self completion bash)
```

### Zsh

#### Setup

First, ensure completion is enabled in your `~/.zshrc`:

```
# Add these lines if not already present
autoload -U compinit
compinit
```

#### 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:

```
source <(dr self completion zsh)
```

### 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:

```
dr self completion fish | source
```

### 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:

```
# Add to profile
dr self completion powershell >> $PROFILE

# Reload profile
. $PROFILE
```

#### Temporary session

For the current session only:

```
dr self completion powershell | Out-String | Invoke-Expression
```

## 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: 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 clone
dr templates clone <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.

1. 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
```

1. Check that bash-completion is loaded:

```
# macOS
brew list bash-completion@2

# Linux (Ubuntu/Debian)
dpkg -l | grep bash-completion
```

1. Verify completion script location:

```
ls -l /etc/bash_completion.d/dr
# or on macOS
ls -l $(brew --prefix)/etc/bash_completion.d/dr
```

1. Check .bashrc sources completion:

```
grep bash_completion ~/.bashrc
```

1. Reload your shell: source~/.bashrc

#### Zsh

1. Verifycompinitis in~/.zshrc: grepcompinit~/.zshrc
2. Check completion file location:

```
ls -l ~/.zsh/completions/_dr
# or
echo $fpath[1]
ls -l $fpath[1]/_dr
```

1. Clear completion cache: rm-f~/.zcompdump
2. Reload Zsh: execzsh

#### Fish

1. Check that the completion file exists: ls-l~/.config/fish/completions/dr.fish
2. Verify that Fish recognizes it: complete-Cdr
3. Reload Fish: source~/.config/fish/config.fish

#### PowerShell

1. Check execution policy: Get-ExecutionPolicy

If it's `Restricted`, change it:

```
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```

1. Verify profile loads completion: cat$PROFILE
2. Reload profile: .$PROFILE

### Permission denied

If you get permission errors when installing:

```
# Use sudo for system-wide installation
sudo dr completion bash > /etc/bash_completion.d/dr

# Or use user-level installation
dr completion bash > ~/.bash_completions/dr
source ~/.bash_completions/dr
```

### Completion cache issues

For Zsh, if completions are outdated:

```
# Clear cache
rm -f ~/.zcompdump*

# Rebuild cache
compinit
```

## 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:

```
# Extract the generated script
dr completion bash > ~/dr-completion.bash

# Edit the script to add custom logic
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:

```
# Install for all shells you use
dr completion bash > ~/.bash_completions/dr
dr completion zsh > ~/.zsh/completions/_dr
dr completion fish > ~/.config/fish/completions/dr.fish
```

## Updating completions

When the CLI is updated, regenerate completions:

```
# Bash
dr completion bash | sudo tee /etc/bash_completion.d/dr

# Zsh
dr completion zsh > ~/.zsh/completions/_dr
rm -f ~/.zcompdump

# Fish
dr completion fish > ~/.config/fish/completions/dr.fish

# PowerShell
dr completion powershell > $PROFILE
```

## See also

- Getting started setup guide
- Command reference
- Cobra documentation (underlying completion framework)
