Shell Completions in Dune Developer Preview

Support for dune shell completions for bash and zsh has just landed in the Dune Developer Preview!

Running the installer adds a snippet to your shell config (e.g. ~/.bashrc) that installs a completion handler for dune. The completion script was taken from here, and that page has some information about how the script was generated. Once it’s installed the completions will work any time dune is typed at the start of a command, so you can still use the completions when running a version of Dune installed with Opam or your system package manager after installing the Dune Developer Preview.

Currently only command completions are supported. So you can run:

$ dune c<TAB>
cache  clean  coq

…or:

$ dune build -<TAB>
--action-stderr-on-success
--action-stdout-on-success
--always-show-command-line
--auto-promote
--build-dir
--build-info
--cache
...

But if you run dune build <TAB> then it will still suggest local files rather than build targets.

Try it out!

Getting started is easy:

$ curl -fsSL https://get.dune.build/install | sh
$ source ~/.bashrc  # or: `source ~/.zshrc` or just restart your shell
$ dune <TAB>
build
cache
clean
coq
describe
diagnostics
exec
...
14 Likes