volta completions
The volta completions
command will generate command completion information for your shell. It has the following syntax:
bash
Generates Volta completions
By default, completions will be generated for the value of your current shell,
shell, i.e. the value of `SHELL`. If you set the `<shell>` option, completions
will be generated for that shell instead.
If you specify a directory, the completions will be written to a file there;
otherwise, they will be written to `stdout`.
USAGE:
volta completions [FLAGS] [OPTIONS] <shell>
FLAGS:
-f, --force Write over an existing file, if any.
--verbose Enables verbose diagnostics
--quiet Prevents unnecessary output
-h, --help Prints help information
OPTIONS:
-o, --output <out_file> File to write generated completions to
ARGS:
<shell> Shell to generate completions for [possible values: zsh, bash, fish, powershell, elvish]
Examples
Generate Completions for Your Current Shell
bash
# Generate completions and print to stdout
volta completions
Generate Completions for a Specific Shell
bash
# Generate Bash completions
volta completions bash
# Generate Zsh completions
volta completions zsh
# Generate Fish completions
volta completions fish
# Generate PowerShell completions
volta completions powershell
# Generate Elvish completions
volta completions elvish
Output Completions to a File
bash
# Save bash completions to a file
volta completions bash -o volta.bash
# Save zsh completions to a file with force overwrite
volta completions zsh -o _volta -f
Installing Completions
After generating completions, you'll need to install them for your shell. Here are common installation methods for different shells:
Bash
bash
# Generate and save bash completions
volta completions bash > ~/.volta-completions.bash
# Add to your ~/.bashrc
echo 'source ~/.volta-completions.bash' >> ~/.bashrc
# Apply changes to current session
source ~/.bashrc
Zsh
bash
# Create a directory for completions if it doesn't exist
mkdir -p ~/.zsh/completions
# Generate and save zsh completions
volta completions zsh > ~/.zsh/completions/_volta
# Add to your ~/.zshrc (if not already included)
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
# Apply changes to current session
source ~/.zshrc
Fish
bash
# Generate and save fish completions
volta completions fish > ~/.config/fish/completions/volta.fish
# Fish will automatically load completions from this directory
PowerShell
powershell
# Generate PowerShell completions
volta completions powershell > volta-completions.ps1
# Add to your PowerShell profile
echo '. /path/to/volta-completions.ps1' >> $PROFILE
# Apply changes to current session
. $PROFILE
Use Cases
Shell completions make using Volta more efficient by:
- Suggesting available subcommands when you type
volta
- Providing tool names for commands like
volta install
orvolta uninstall
- Completing flags and options
- Improving productivity by reducing typing and errors