4

With stack build tool I need to add the following line to my system config and autocompletion works:

eval "$(stack --bash-completion-script stack)"

But autocompletion for cabal-install doesn't work out of the box and I can't find a way to do this. How can I enable bash autocompletion for cabal-install (my cabal-install version: 2.1.0.0)?

My OS: Ubuntu 16.04.03 LTS

Shersh
  • 9,019
  • 3
  • 33
  • 61

1 Answers1

3

There's a cabal-install autocomplete script here. You just need to source it somewhere in your shell: https://github.com/haskell/cabal/blob/master/cabal-install/bash-completion/cabal

For ubuntu, you should be able to do it by just tossing it in /etc/bash_completion.d

sclv
  • 38,665
  • 7
  • 99
  • 204
  • Thanks a lot for this script! Could you please provide exact command? I'm not a `bash` expert... Won't something like this work: `curl https://raw.githubusercontent.com/haskell/cabal/master/cabal-install/bash-completion/cabal | source`? – Shersh Feb 14 '18 at 12:46
  • I mean just download the file and put it into the directory I suggested... – sclv Feb 14 '18 at 23:55