if [[ $COMP_CWORD -le $cmd_index ]]; then
# The user has not specified a command yet
local all_commands="$(tmux -q list-commands | cut -f 1 -d ' ')"
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${all_commands}" -- "${cur}") )
I am trying to understand above code snippet for tmux bash autocompletion
compgen's W argument takes a word-list. But why does it taken an extra option -- with the current word, ${cur} as argument?
What does :- inside flower brackets mean?${COMPREPLY[@]:-}
When i do, tmux<tab>
the completion list displayed is same as $(tmux -q list-commands | cut -f 1 -d ' ').
So, why do we need ${COMPREPLY[@]:-} in the array beginning?