Skip to content

Shell Completions

Enable tab completion for redisctl commands.

Supported shells: bash, zsh, fish, powershell, elvish

Dynamic completions query the redisctl binary at runtime, enabling context-aware completions such as profile names from your config file, file path hints, and URL hints.

To enable, add the registration one-liner to your shell's config file. You can print the command with --register:

redisctl completions <shell> --register
# Add to ~/.bashrc
source <(COMPLETE=bash redisctl)
# Add to ~/.zshrc
source <(COMPLETE=zsh redisctl)
# Add to ~/.config/fish/config.fish
source (COMPLETE=fish redisctl | psub)
# Add to $PROFILE
COMPLETE=powershell redisctl | Invoke-Expression
# Add to ~/.elvish/rc.elv
eval (E:COMPLETE=elvish redisctl)

Dynamic completions provide:

  • Profile names from your config (e.g., --profile my<Tab> completes to configured profiles)
  • File path hints for --config-file and --ca-cert
  • URL hints for --url and --api-url
  • Executable path hints for --redis-cli

Static Completions (Fallback)

Static scripts complete subcommands and flags but have no awareness of runtime values like profile names. Use these if dynamic completions are not supported in your environment.

redisctl completions <shell>

Installation

# Create completions directory if needed
mkdir -p ~/.local/share/bash-completion/completions

# Generate and install
redisctl completions bash > ~/.local/share/bash-completion/completions/redisctl

# Reload shell or source the file
source ~/.local/share/bash-completion/completions/redisctl
# Create completions directory if needed
mkdir -p ~/.zfunc

# Add to fpath (add this to ~/.zshrc)
fpath=(~/.zfunc $fpath)

# Generate completions
redisctl completions zsh > ~/.zfunc/_redisctl

# Rebuild completion cache
rm -f ~/.zcompdump; compinit
# Generate and install
redisctl completions fish > ~/.config/fish/completions/redisctl.fish

# Reload shell
source ~/.config/fish/completions/redisctl.fish
# Add to profile
redisctl completions powershell >> $PROFILE

# Reload profile
. $PROFILE

Usage

After installation, press Tab to complete:

# Complete commands
redisctl ent<Tab>
# → redisctl enterprise

# Complete subcommands
redisctl enterprise cl<Tab>
# → redisctl enterprise cluster

# Complete options
redisctl enterprise cluster get --<Tab>
# → --output  --query  --profile  ...

Homebrew Users

If you installed via Homebrew, completions may be automatically available. If not:

# Bash
echo 'source $(brew --prefix)/etc/bash_completion.d/redisctl' >> ~/.bashrc

# Zsh
echo 'source $(brew --prefix)/share/zsh/site-functions/_redisctl' >> ~/.zshrc

Troubleshooting

Completions Not Working

  1. Verify the file was created:

    ls -la ~/.local/share/bash-completion/completions/redisctl
    

  2. Check your shell's completion system is enabled:

    # Bash - add to ~/.bashrc
    if [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
    fi
    

  3. Restart your shell or source the completion file.

Zsh: Command Not Found: compinit

Add to your ~/.zshrc:

autoload -Uz compinit
compinit