Skip to content

Commit

Permalink
Fix bash completion with multiple file arguments (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski committed Dec 2, 2023
1 parent 92c4885 commit f0022d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mock/etc/bash_completion.d/mock
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ _mock()

local cfgdirs=( /etc/mock "$HOME/.config/mock" )
local count=0
local prevopt
for word in "${words[@]}" ; do
[[ $count -eq $cword ]] && break
if [[ $count -eq $cword ]] ; then
[[ ${word:0:1} == - ]] && prevopt=
break
fi
[[ ${word:0:1} == - ]] && prevopt=$word
if [[ "$word" == --configdir ]] ; then
cfgdirs=( "${words[((count+1))]}" )
elif [[ "$word" == --configdir=* ]] ; then
Expand All @@ -40,7 +45,7 @@ _mock()
count=$((++count))
done

case "$prev" in
case "$prevopt" in
-h|--help|--version)
# no further arguments are accepted after the above arguments
return
Expand Down

0 comments on commit f0022d2

Please sign in to comment.