Hello,
I wanted to improve the shell (as in bash/zsh/fish/...) completions for
mix and its subcommands. But before I do I figured I should ask here.
First off, is this something people are interested in?
---
If so, here's a sketch for the implementation. TL;DR, let mix generate
completions for each shell in a known place and let those be loaded by a
small script/completion that's shipped by OS package managers and/or the
shell itself.
The entry point needs to live in some sort of distribution, typically
the OS package manager or the shell itself. This script should be kept
as simple as possible, and hopefully stable over time. Its primary
function is to figure out where the generated completions (more on that
below) are. We want to do this dynamically to support multiple versions
of Elixir, for example if you use something like
https://asdf-vm.com/.
This means that the entry point script must support both older and newer
versions of Elixir, so it needs some sort of decent fallback as well.
That could probably be just `mix --names`.
Once these generated completions are found, we can literally just source
them. The hard part is generating them in the first place. Which I think
should be done on installation, so `mix archive.*` and/or `mix deps.*`.
I imagine the easiest/cleanest solution would be to extend OptionParser
to do the actual completion generation, and as part of that, extend the
swatches definition to include descriptions for each flag.
This could also be used to generate the markdown list of options I've
seen in @shortdesc. I also would like to add support for a @swatches
attribute (like the one used in Phoenix).
Thoughts?
Sincerely Max Sörliden Nordlund