Skip to main content

Generate

Command

$ vela generate completion <parameters...> <arguments...>
info

For more information, you can run vela generate completion --help.

Parameters

The following parameters are used to configure the command:

NameDescriptionEnvironment Variables
bashgenerate a Bash auto-completion scriptVELA_BASH, COMPLETION_BASH
zshgenerate a Zsh auto-completion scriptVELA_ZSH, COMPLETION_ZSH

Permissions

COMING SOON!

Sample

warning

This section assumes you have already installed and setup the CLI.

To install the CLI, please review the installation documentation.

To setup the CLI, please review the authentication documentation.

Request

vela generate completion --bash

Response

#! /bin/bash

_cli_bash_autocomplete() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"

if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
fi

COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete vela

Permanent Automatic Completion

This section covers how to enable auto-completion for your terminal permanently.

Bash

info

This section assumes you have a version of Bash greater than 4.

You can check your Bash version with:

bash --version

If you have a version older than 4, you can use brew to install a newer version.

brew install bash
  1. Install v2 of Bash Completion
brew install bash-completion@2
  1. Copy Vela Bash Completion script
vela generate completion --bash >> /usr/local/etc/bash_completion.d/vela.sh
  1. Update Bash Profile with Completion
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" >> $HOME/.bash_profile
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" >> $HOME/.bash_profile
  1. Source Bash Profile in Current Terminal
source $HOME/.bash_profile

Zsh

  1. Update Zsh Profile with Completion
source <(vela generate completion --zsh) >> $HOME/.zshrc
info

If you're met with an error like:

complete:13: command not found: compdef

Then you need to add the following to the top of your $HOME/.zshrc:

autoload -Uz compinit
compinit