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.
neon completionimportant
Section titled “important”Generate the completion script in your own terminal, as the script may differ depending on your operating environment.
Show 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-###Examples
Section titled “Examples”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:
neon completion >> ~/.bashrc
source ~/.bashrcAdd the completion script to .bash_profile:
neon completion >> ~/.bash_profile
source ~/.bash_profileAdd the completion script to .profile:
neon completion >> ~/.profile
source ~/.profileAdd the completion script to .zshrc:
neon completion >> ~/.zshrc
source ~/.zshrc