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:
1rover completion bashThis outputs a bash completion script to stdout. To enable bash completion, save the output to a file and source it in your shell configuration:
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 terminalYou'll now have tab completion for Rover commands.
completion zsh
The completion zsh command generates a zsh completion script:
1rover completion zshThis outputs a zsh completion script to stdout. To enable zsh completion, save the output to a file and source it in your shell configuration:
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 terminalYou'll now have tab completion for Rover commands.
Alternatively, you can use zsh's completion system by placing the script in your fpath:
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)
8compinitUsing completion
Once enabled, you can use tab completion to:
Complete command names: Type
roverand pressTabto see available commandsComplete subcommands: Type
rover graphand pressTabto see available graph subcommandsComplete options: Type
rover graph publishand pressTabto see available options and flags
Testing completion
To verify that completion is working correctly:
Open a new terminal or reload your shell configuration
Type
rover(with a space) and pressTab- you should see a list of available commandsType
rover graand pressTab- it should autocomplete torover graphContinue typing
rover graphand pressTab- you should see available subcommands likecheck,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
~/.bashrcor~/.bash_profileFor zsh: The script is being sourced in your
~/.zshrcor is in yourfpath