-
Notifications
You must be signed in to change notification settings - Fork 6
Tab Completion Scripts
Tab Completion Scripts can be generated for Bash, Zsh, and Powershell. These scripts allow users to press Tab
to complete the next Command or Option available for your project based on the current input.
Tab Completion Scripts are configured with the cova.generate.TabCompletionConfig
struct which can be set up directly in the Meta Doc Config using the cova.generate.MetaDocConfig.tab_complete_config
field. Within the Config, there are self-explanatory fields for configuring the following categories:
- Generated Filepath
- Header & Name Strings
- Argument Inclusion Toggles
- Cova Message & Installation Instruction Toggles
Note, the following instructions are included (nearly verbatim) in each Tab Completion Script of the corresponding shell by default. This behavior can be toggled with cova.generate.TabCompletionConfig.add_install_instructions
.
Bash Completion Installation Instructions for your project:
-
Place this script in a directory like
/etc/bash_completion.d/
(Linux) or/usr/local/etc/bash_completion.d/
(Mac, if using Homebrew and bash-completion) -
Ensure the script has executable permissions:
-
chmod +x project-name-completion.bash
-
-
Source this script from your
.bashrc
or.bash_profile
by adding:-
. /path/to/project-name-completion.bash
-
-
Restart your terminal session or source your profile again:
-
source ~/.bashrc # or ~/.bash_profile
-
Zsh Completion Installation Instructions for your project:
-
Place this script in a directory specified in your
$fpath
, such as~/.zsh/completion/
-
Ensure the script has executable permissions:
-
chmod +x project-name-completion.zsh
-
-
Add the script's directory to your
$fpath
in your.zshrc
if not already included:-
fpath=(~/.zsh/completion $fpath)
-
-
Enable and initialize completion in your
.zshrc
if you haven't already:-
autoload -Uz compinit && compinit
-
-
Restart your terminal session or source your
.zshrc
again:-
source ~/.zshrc
-
PowerShell Completion Installation Instructions for your project:
-
Load the completion script into your current PowerShell session:
-
. .\project-name-completion.ps1
-
-
Ensure your Execution Policy allows the script to be run. Example:
-
Set-ExecutionPolicy RemoteSigned
-
-
To ensure this completion script is loaded automatically in future sessions, add the above sourcing command to your PowerShell profile:
-
Notepad $PROFILE
- Add the line:
. C:\path\to\project-name-completion.ps1
-
-
Restart your PowerShell session or source your profile again:
-
. $PROFILE
-
Looking for Cova's API Documentation? Click here!