Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
104 lines (70 sloc) 2.78 KB
title
Completion Command

The amp completion command allows you to add shell completion to your AMP CLI.

Usage

$ amp completion --help

Usage:	amp completion SHELL [flags]

Output shell completion code for the specified shell (bash or zsh)

Examples:

		# Install bash completion on a Mac using homebrew

		    $ brew install bash-completion

		Once installed, bash_completion must be evaluated.  This can be done by adding the
		following line to the .bash_profile, and reloading it

		    source $(brew --prefix)/etc/bash_completion

		    $ source $HOME/.bash_profile

		# Write bash completion code to a file

		    $ amp completion bash > ~/.config/amp/completion.bash.inc

		Add this line in your $HOME/.bash_profile, and reload it

		    source "$HOME/.config/amp/completion.bash.inc"

		    $ source $HOME/.bash_profile

		# Load the amp completion code for zsh[1] into the current shell
		source <(amp completion zsh)

Options:
  -h, --help            Print usage
  -k, --insecure        Control whether amp verifies the server's certificate chain and host name
  -s, --server string   Specify server (host:port)

TIP: Use -h or --help option for any of the AMP commands or sub-commands to more information about the command's usage.

Installation

In order to use shell completion with AMP, follow the installation instructions for your corresponding shell.

Bash

Make sure bash completion is installed:

  • Most current Linux OS (non-minimal installations) have bash completion.
  • On Mac, install with brew install bash-completion

After bash completion is installed, add the following line to your ~/.bash_profile file:

source $(brew --prefix)/etc/bash_completion

Then, either source your ~/.bash_profile or launch a new terminal.

Now you need to write the bash completion, generated by AMP, to a file. We recommend writing it to a file in your $HOME/.config/amp directory.

$ amp completion bash > ~/.config/amp/completion.bash.inc

After doing this, add the following line to your ~/.bash_profile file to source your bash completion file.

source "$HOME/.config/amp/completion.bash.inc"

Then either source your ~/.bash_profile or launch a new terminal again.

Zsh

In a Zsh shell, load the amp completion code with:

$ source <(amp completion zsh)

or add source <(amp completion zsh) to your ~/.zshrc file.

Examples

With the shell completion code loaded for AMP, you can hit tab twice to view the shell completion.

$ amp
cluster     completion  config      login       logout      logs        password    service     stack       stats       team        user        version     whoami
$ amp stack
deploy    logs      ls        rm        services
$ amp stack deploy -c examples/stacks/pinger/
README.md   pinger.yml
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.