stack autocompletion setup does not work in zsh:
➜ eval "$(stack --bash-completion-script "$(which stack)")"
zsh: command not found: complete
On bash (same machine, same user), it works
I had the same problem, but found the solution was to load the bashcompinit module
λ church ~ → eval "$(stack --bash-completion-script "$(which stack)")"
zsh: command not found: complete
λ church ~ → autoload bashcompinit
λ church ~ → bashcompinit
λ church ~ → eval "$(stack --bash-completion-script "$(which stack)")"
λ church ~ → stack
bench docker/ ghc --help --no-install-ghc runghc test -v --version
build/ --docker* ghci install --no-system-ghc setup unpack --verbose
clean exec haddock --install-ghc path --system-ghc update --verbosity
@rvion Would you be able to update the documentation to clarify this requirement for zsh users?
stack autocomple displaying enough information for newcomers to discover and setup autocompletion from here ?documentation says:
Zsh can handle bash completions functions. The latest development version of zsh has a function bashcompinit, that when run will allow zsh to read bash completion specifications and functions. This is documented in the zshcompsys man page. To use it all you need to do is run bashcompinit at any time after compinit. It will define complete and compgen functions corresponding to the bash builtins.
You must so:
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
source /path/to/your/bash_completion_script
:information_source: If you already have quite a large zshrc, or if you use oh-my-zsh, compinit will probably already be loaded. If you have a blank zsh config, all of the 3 lines above are necessary.
:gem: tip: instead of running those 3 lines from your shell every time you want to use stack, you can add those 3 lines in your $HOME/.zshrc file
Looks good. I'm at about -0.5 on adding a command to stack for this, since our --help output is already becoming a bit intimidating. But I could be swayed otherwise.
I'm creating an other specific page in the wiki not to pollute the FAQ, and will link the new page from here.
Current state makes it too hard to discover the feature (I had to search over the 10 pages wiki to find it)
Thanks!
On Mon, Jun 15, 2015 at 3:49 PM Rémi Vion [email protected] wrote:
done
- see diff of FAQ page
https://github.com/commercialhaskell/stack/wiki/FAQ/_compare/bb85a2d9a405f31edc1336311210e96624d9e5e0%5E...bb85a2d9a405f31edc1336311210e96624d9e5e0- new Shell-autocompletion page
https://github.com/commercialhaskell/stack/wiki/Shell-autocompletion—
Reply to this email directly or view it on GitHub
https://github.com/commercialhaskell/stack/issues/306#issuecomment-112055397
.
Most helpful comment
stack autocompledisplaying enough information for newcomers to discover and setup autocompletion from here ?Shell Autocompletion:
for ZSH users:
documentation says:
You must so:
:information_source: If you already have quite a large zshrc, or if you use oh-my-zsh, compinit will probably already be loaded. If you have a blank zsh config, all of the 3 lines above are necessary.
:gem: tip: instead of running those 3 lines from your shell every time you want to use stack, you can add those 3 lines in your $HOME/.zshrc file