Skip to content

Commit

Permalink
Fix bash-completion after "--"
Browse files Browse the repository at this point in the history
#3272 accidentally disabled completions at the start of flags,
e.g. on "cabal install --".
[CI SKIP]
  • Loading branch information
lspitzner committed Apr 2, 2016
1 parent 8b33d3a commit 9018c27
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cabal-install/bash-completion/cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ _cabal_subcommands()

__cabal_has_doubledash ()
{
for w in "${COMP_WORDS[@]}"
do
if [ "--" == "$w" ]; then
local c=1
# Ignore the last word, because it is replaced anyways.
# This allows expansion for flags on "cabal foo --",
# but does not try to complete after "cabal foo -- ".
local n=$((${#COMP_WORDS[@]} - 1))
while [ $c -lt $n ]; do
if [ "--" = "${COMP_WORDS[c]}" ]; then
return 0
fi
((c++))
done
return 1
}
Expand Down

0 comments on commit 9018c27

Please sign in to comment.