# Shell completion

> Shell completion - Generate shell completion scripts for command auto-completion.

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.545681+00:00` (UTC).

## Primary page

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

## Sections on this page

- [Synopsis](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#synopsis): In-page section heading.
- [Description](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#description): In-page section heading.
- [Supported shells](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#supported-shells): In-page section heading.
- [Usage](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#usage): In-page section heading.
- [Bash](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#bash): In-page section heading.
- [Zsh](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#zsh): In-page section heading.
- [Fish](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#fish): In-page section heading.
- [PowerShell](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#powershell): In-page section heading.
- [Examples](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#examples): In-page section heading.
- [Generate completion script](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#generate-completion-script): In-page section heading.
- [Install for multiple shells](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#install-for-multiple-shells): In-page section heading.
- [Update completions](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#update-completions): In-page section heading.
- [Completion behavior](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#completion-behavior): In-page section heading.
- [Command completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#command-completion): In-page section heading.
- [Flag completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#flag-completion): In-page section heading.
- [Argument completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#argument-completion): In-page section heading.
- [Troubleshooting](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#troubleshooting): In-page section heading.
- [Completions not working](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#completions-not-working): In-page section heading.
- [Permission denied](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#permission-denied): In-page section heading.
- [Outdated completions](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#outdated-completions): In-page section heading.
- [Completion features](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#completion-features): In-page section heading.
- [Intelligent suggestions](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#intelligent-suggestions): In-page section heading.
- [Description support](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#description-support): In-page section heading.
- [Dynamic completion](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#dynamic-completion): In-page section heading.
- [Advanced configuration](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#advanced-configuration): In-page section heading.
- [Custom completion scripts](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#custom-completion-scripts): In-page section heading.
- [Completion performance](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.html#completion-performance): In-page section heading.
- [See also](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/completion.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.
- [Command reference](https://docs.datarobot.com/en/docs/agentic-ai/cli/commands/index.html): Linked from this page.
- [Shell completion guide](https://docs.datarobot.com/en/docs/agentic-ai/cli/shell-completions.html): Linked from this page.
- [Getting started](https://docs.datarobot.com/en/docs/agentic-ai/cli/getting-started.html): Linked from this page.

## Documentation content

Generate shell completion scripts for command auto-completion.

## Synopsis

```
dr self completion <shell>
```

## Description

The `self completion` command generates shell completion scripts that enable auto-completion for the DataRobot CLI. Completions provide command, subcommand, and flag suggestions when you press Tab.

## Supported shells

- bash —Bourne Again Shell.
- zsh —Z Shell.
- fish —Friendly Interactive Shell.
- powershell —PowerShell.

## Usage

### Bash

Linux:

```
# Install system-wide
dr self completion bash | sudo tee /etc/bash_completion.d/dr

# Reload shell
source ~/.bashrc
```

macOS:

```
# 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_profile
```

Temporary (current session only):

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

### Zsh

Setup:

First, ensure completion is enabled:

```
# Add to ~/.zshrc if not present
autoload -U compinit
compinit
```

Installation:

```
# 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 ~/.zshrc
```

Temporary (current session only):

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

### Fish

```
# Install completion
dr self completion fish > ~/.config/fish/completions/dr.fish

# Reload Fish
source ~/.config/fish/config.fish
```

Temporary (current session only):

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

### PowerShell

Persistent:

```
# Generate completion script
dr self completion powershell > dr.ps1

# Add to PowerShell profile
Add-Content $PROFILE ". C:\path\to\dr.ps1"

# Reload profile
. $PROFILE
```

Temporary (current session only):

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

## Examples

### Generate completion script

```
# 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.ps1
```

### Install for multiple shells

If 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.fish
```

### Update completions

After 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
```

## Completion behavior

### Command completion

```
$ dr <Tab>
auth       completion dotenv     run        templates  version

$ dr auth <Tab>
login      logout     set-url

$ dr templates <Tab>
clone      list       setup      status
```

### Flag completion

```
$ dr run --<Tab>
--concurrency  --dir         --exit-code   --help
--list         --parallel    --silent      --watch
--yes

$ dr --<Tab>
--debug    --help     --verbose
```

### Argument completion

Some commands support argument completion:

```
# Template names (when connected to DataRobot)
$ dr templates clone <Tab>
python-streamlit  react-frontend  fastapi-backend

# Task names (when in a template directory)
$ dr run <Tab>
build  dev  deploy  lint  test
```

## Troubleshooting

### Completions not working

Bash:

1. Verify bash-completion is installed: # macOSbrewlistbash-completion@2# Linuxdpkg-l|grepbash-completion
2. Check if completion script exists: ls-l/etc/bash_completion.d/dr
3. Ensure .bashrc sources completions: grepbash_completion~/.bashrc
4. Reload shell: source~/.bashrc

Zsh:

1. Verify compinit is called: grepcompinit~/.zshrc
2. Check fpath includes completion directory: echo$fpath
3. Clear completion cache: rm-f~/.zcompdump*
compinit
4. Reload shell: execzsh

Fish:

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

PowerShell:

1. Check execution policy: Get-ExecutionPolicy

If restricted:

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

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

### Permission denied

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)' >> ~/.zshrc
```

### Outdated completions

After 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.fish
```

## Completion features

### Intelligent suggestions

Completions are context-aware:

```
# Only shows valid subcommands
dr auth <Tab>
# Shows: login logout set-url (not other commands)

# Only shows valid flags
dr run --l<Tab>
# Shows: --list (not all flags)
```

### Description support

In Fish and PowerShell, completions include descriptions:

```
$ dr templates <Tab>
clone   (Clone a template repository)
list    (List available templates)
setup   (Interactive template setup wizard)
status  (Show current template status)
```

### Dynamic completion

Some completions are generated dynamically:

```
# Template names from DataRobot API
dr templates clone <Tab>

# Task names from current Taskfile
dr run <Tab>

# Available shells
dr self completion <Tab>
```

## Advanced configuration

### Custom completion scripts

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

### Completion performance

For faster completions, especially with dynamic suggestions:

```
# Cache template list
dr templates list > ~/.dr-templates-cache

# Use cached list in custom completion script
```

## See also

- Shell completion guide —detailed setup instructions.
- Getting started —initial setup.
- Command completion is powered by Cobra .
