Skip to content

Azion CLI autocomplete

Gabriel França edited this page Sep 12, 2023 · 2 revisions

Setup Autocomplete

Please verify if you have autocomplete enabled globally, otherwise the autocomplete for cli will not work

Dependencies zsh

You need to install zsh-autosuggestions

MacOs

brew install zsh-autosuggestions

Linux

git clone https://github.com/zsh-users/zsh-autosuggestions \${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Installing autocomplete for azion cli only


MacOs / Linux

Run

echo "autoload -U compinit; compinit" >> ~/.zshrc 

Then run

echo "source <(azion completion zsh); compdef _azion azion" >> ~/.zshrc

If you uninstall azion cli, please edit your ~/.zshrc file and remove the line source <(azion completion zsh); compdef _azion azion

Installing autocomplete globally


MacOs

Run

echo "autoload -U compinit; compinit" >> ~/.zshrc 

Then open your ~/.zshrc file, and add the following content to it

if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

Linux

Open your ~/.zshrc file and add the following content to it

plugins=(zsh-autosuggestions)

If you have other plugins, just add zsh-zutosuggestions to the end.

Whether you chose to activate autocomplete globally or for azion cli only, the steps of each section should only be run once. After that, autocomplete will work every time you open a new terminal.

Dependencies bash

You need to install bash-completion

MacOs

brew install bash-completion

Centos/RHEL 7

yum install bash-completion bash-completion-extras

Debian/Ubuntu

apt-get install bash-completion

Alpine

apk add bash-completion

Installing autocomplete for azion cli only


MacOs / Linux

Run

echo "source <(azion completion bash)" >> ~/.bashrc 

If you uninstall azion cli, please edit your ~/.bashrc file and remove the line source <(azion completion bash)

Installing autocomplete globally


MacOS

Open your ~/.bashrc file, and add the following content to it

BREW_PREFIX=$(brew --prefix)
[[ -r "${BREW_PREFIX}/etc/profile.d/bash_completion.sh" ]] && . ${BREW_PREFIX}/etc/profile.d/bash_completion.sh

Linux

Run

echo "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc

Whether you chose to activate autocomplete globally or for azion cli only, the steps of each section should only be run once. After that, autocomplete will work every time you open a new terminal.

Dependencies fish

Run the command below once

echo "azion completion fish | source" >> ~/.config/fish/config.fish

If you uninstall azion cli, please edit your ~/.config/fish/config.fish file and remove the line azion completion fish | source

Clone this wiki locally