diff --git a/mock/etc/bash_completion.d/mock b/mock/etc/bash_completion.d/mock index 922a25267..5e3768d92 100644 --- a/mock/etc/bash_completion.d/mock +++ b/mock/etc/bash_completion.d/mock @@ -30,8 +30,13 @@ _mock() local cfgdirs=( /etc/mock "$HOME/.config/mock" ) local count=0 + local lastopt for word in "${words[@]}" ; do - [[ $count -eq $cword ]] && break + if [[ $count -eq $cword ]] ; then + [[ ${word:0:1} == - ]] && lastopt= + break + fi + [[ ${word:0:1} == - ]] && lastopt=$word if [[ "$word" == --configdir ]] ; then cfgdirs=( "${words[((count+1))]}" ) elif [[ "$word" == --configdir=* ]] ; then @@ -40,7 +45,7 @@ _mock() count=$((++count)) done - case "$prev" in + case "$lastopt" in -h|--help|--version) # no further arguments are accepted after the above arguments return