2014-04-12 21:59:41 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2015-08-29 01:15:08 +00:00
|
|
|
: ${PROG:=$(basename ${BASH_SOURCE})}
|
|
|
|
|
2014-04-12 21:59:41 +00:00
|
|
|
_cli_bash_autocomplete() {
|
2019-08-05 15:07:46 +00:00
|
|
|
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
|
2017-04-06 13:11:23 +00:00
|
|
|
local cur opts base
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
2019-08-05 14:58:04 +00:00
|
|
|
if [[ "$cur" == "-"* ]]; then
|
2019-03-20 14:58:51 +00:00
|
|
|
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
|
|
|
|
else
|
|
|
|
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
|
|
|
|
fi
|
2017-04-06 13:11:23 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
2019-07-24 14:08:47 +00:00
|
|
|
fi
|
2017-04-06 13:11:23 +00:00
|
|
|
}
|
|
|
|
|
2019-07-24 14:08:47 +00:00
|
|
|
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete $PROG
|
2017-04-06 13:11:23 +00:00
|
|
|
unset PROG
|