Commit 9018c27b authored by lspitzner's avatar lspitzner
Browse files

Fix bash-completion after "--"

#3272 accidentally disabled completions at the start of flags,
e.g. on "cabal install --".
[CI SKIP]
parent 8b33d3ae
...@@ -55,11 +55,16 @@ _cabal_subcommands() ...@@ -55,11 +55,16 @@ _cabal_subcommands()
__cabal_has_doubledash () __cabal_has_doubledash ()
{ {
for w in "${COMP_WORDS[@]}" local c=1
do # Ignore the last word, because it is replaced anyways.
if [ "--" == "$w" ]; then # 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 return 0
fi fi
((c++))
done done
return 1 return 1
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment