File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1010 local result=()
1111
1212 # words the user already typed (excluding the command itself)
13- local used=(" ${COMP_WORDS[@]: 1: $((COMP_CWORD - 1))} " )
13+ local used=()
14+ if (( COMP_CWORD > 1 )) ; then
15+ used=(" ${COMP_WORDS[@]: 1: $((COMP_CWORD - 1))} " )
16+ fi
1417
1518 if [[ " ${cur: 0: 1} " == " -" ]]; then
1619 # Completing an option: offer everything (including options)
3841
3942< %= function_name %> () {
4043 local cur=${COMP_WORDS[COMP_CWORD]}
41- local compwords=(" ${COMP_WORDS[@]: 1: $COMP_CWORD -1} " )
44+ local compwords=()
45+ if (( COMP_CWORD > 0 )) ; then
46+ compwords=(" ${COMP_WORDS[@]: 1: $((COMP_CWORD - 1))} " )
47+ fi
4248 local compline=" ${compwords[*]} "
4349
50+ COMPREPLY=()
51+
4452% if ENV[' COMPLETELY_DEBUG' ]
4553 if [[ -n " $COMPLETELY_DEBUG " ]]; then
4654 echo " compline: '$compline '" > ' completely-debug.txt'
You can’t perform that action at this time.
0 commit comments