Skip to main content
Neon Postgres Docs

Search documentation

Type to search this documentation.

On this pageOverview

Neon CLI command: completion

The completion command generates a shell completion script for neon. Once installed, the script presents the possible commands and options when you press the tab key after typing or partially typing a...

The completion command generates a shell completion script for neon. Once installed, the script presents the possible commands and options when you press the tab key after typing or partially typing a command or option.

Bash
neon completion

Generate the completion script in your own terminal, as the script may differ depending on your operating environment.

Show output
title="Output"
###-begin-neon-completions-###
#
# yargs command completion script
#
# Installation: neon completion >> ~/.bashrc
#    or neon completion >> ~/.bash_profile on OSX.
#
_neon_yargs_completions()
{
    local cur_word args type_list

    cur_word="${COMP_WORDS[COMP_CWORD]}"
    args=("${COMP_WORDS[@]}")

    # ask yargs to generate completions.
    type_list=$(neon --get-yargs-completions "${args[@]}")

    COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )

    # if no match was found, fall back to filename completion
    if [ ${#COMPREPLY[@]} -eq 0 ]; then
      COMPREPLY=()
    fi

    return 0
}
complete -o bashdefault -o default -F _neon_yargs_completions neon
###-end-neon-completions-###

Add the completion script to your shell configuration file in your home directory. The file differs by platform: Ubuntu typically uses .bashrc, while macOS uses .bash_profile or .zshrc. The source command applies the change to the current shell session.

Add the completion script to .bashrc:

Bash
neon completion >> ~/.bashrc
source ~/.bashrc

Add the completion script to .bash_profile:

Bash
neon completion >> ~/.bash_profile
source ~/.bash_profile

Add the completion script to .profile:

Bash
neon completion >> ~/.profile
source ~/.profile

Add the completion script to .zshrc:

Bash
neon completion >> ~/.zshrc
source ~/.zshrc
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu