Rover completion Commands

Generate shell completion scripts for bash and zsh


Rover provides shell completion support for bash and zsh, enabling tab completion for Rover commands and their options. This makes it easier to discover available commands and options while working in the terminal.

Generating completion scripts

completion bash

The completion bash command generates a bash completion script:

Text
1rover completion bash

This outputs a bash completion script to stdout. To enable bash completion, save the output to a file and source it in your shell configuration:

Bash
1# Save the completion script
2rover completion bash > ~/.rover-completion.bash
3
4# Add to your ~/.bashrc or ~/.bash_profile
5echo "source ~/.rover-completion.bash" >> ~/.bashrc
6
7# Reload your shell configuration
8source ~/.bashrc  # or restart your terminal

You'll now have tab completion for Rover commands.

completion zsh

The completion zsh command generates a zsh completion script:

Text
1rover completion zsh

This outputs a zsh completion script to stdout. To enable zsh completion, save the output to a file and source it in your shell configuration:

zsh
1# Save the completion script
2rover completion zsh > ~/.rover-completion.zsh
3
4# Add to your ~/.zshrc
5echo "source ~/.rover-completion.zsh" >> ~/.zshrc
6
7# Reload your shell configuration
8source ~/.zshrc  # or restart your terminal

You'll now have tab completion for Rover commands.

Alternatively, you can use zsh's completion system by placing the script in your fpath:

zsh
1# Create completion directory if it doesn't exist
2mkdir -p /usr/local/share/zsh/site-functions
3
4# Save the completion script to fpath
5rover completion zsh > /usr/local/share/zsh/site-functions/_rover
6
7# Reload completions (or restart your terminal)
8compinit

Using completion

Once enabled, you can use tab completion to:

  • Complete command names: Type rover and press Tab to see available commands

  • Complete subcommands: Type rover graph and press Tab to see available graph subcommands

  • Complete options: Type rover graph publish and press Tab to see available options and flags

Testing completion

To verify that completion is working correctly:

  1. Open a new terminal or reload your shell configuration

  2. Type rover (with a space) and press Tab - you should see a list of available commands

  3. Type rover gra and press Tab - it should autocomplete to rover graph

  4. Continue typing rover graph and press Tab - you should see available subcommands like check, publish, fetch, etc.

If completion isn't working, ensure that:

  • You've reloaded your shell configuration or opened a new terminal

  • The completion script file exists and is readable

  • For bash: The script is being sourced in your ~/.bashrc or ~/.bash_profile

  • For zsh: The script is being sourced in your ~/.zshrc or is in your fpath

Feedback

Edit on GitHub

Ask Community