completion
Prints the bash completion function and the commands that allow you to configure CLI autocomplete.
The cb completion
command returns the following:
_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
base=${COMP_WORDS[@]:0:$COMP_CWORD}
wrd_num=$(echo $base | wc -w | awk '{print $1}')
word=$(echo $base | awk "{print \$$wrd_num}")
if [[ ! "$word" == --* ]]; then
opts=$( ${base} --generate-bash-completion )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
else
COMPREPLY=()
fi
return 0
}
complete -o default -F _cli_bash_autocomplete cb
# Run one of these commands to configure your shell:
# eval "$(cb completion)"
# source <(cb completion)
Use one of the following commands to configure CLI autocomplete:
Note | |
---|---|
Prior to running these commands, the |
eval "$(cb completion)"
source <(cb completion)
Once configured, type the CLI commands as usual and use the Tab key to automatically complete the commands.