A dynamic shell auto-completion for rustc and cargo?

Hello Rust community!

TL;DR Proposing a dynamic shell autocompletion for rustc and cargo, with which you can dynamically query all flags defined in rust and require the minimal amount of hardcoding in shell scripts. Looking for mentors who are interested in mentoring me for this project or people who are interested in doing this project.

I come from C++ (usually coping with Cling/Clang) and recently got interested in Rust. I was playing with rustc, and was not satisfied with its shell autocompletion (if any, at least there was no default shell autocompletion on my Archlinux zsh & bash).

That’s why I thought adding dynamic shell autocompletion for Rust will help its users. Last year we added a dynamic shell autocompletion support in Clang 5.0, and I think this design can be applied to Rust as well. The idea of a design is different from existing projects. The basic idea here is to add a flag to rustc which returns available flags with discription (try clang --autocomplete=-fno, it returns all flags starting with “-fno”). This gives nice features like:

  • No hardcoding in shell-script. It’ll be looking very light like this.
  • No maintenance. You don’t have to modify anything when new flag was added or deleted.
  • Flag value completion. Users will be able to complete “flag values”, for example rustc --emit [tab] can give an available value (asm, llvm-bc…)

I’m interested in doing this project by myself, but I will need some volunteers who know how rust Driver works. I’m also very happy to discuss with a developer who is interested in doing this by themselves. Open to any comments!

Cargo has bash completion on my system (arch linux as well). May this be a configuration problem?

I had shell-completion for cargo, but not for rustc. Still, I think it’s nice to have dynamic query instead of hardcoding in shell script.