|2021.819.909||Aug 19, 2021|
#72 in Build Utils
Full auto-completion for cargo-auto and automation_tasks_rs and partial auto-completion for cargo in bash
repository; version: 2021.819.909 date: 2021-08-19 authors: Luciano Bestia
Install the binary:
cargo install dev_bestia_cargo_completion
Save definition for auto_completion in bash:
complete -C "dev_bestia_cargo_completion" cargo
cargo b and press
It should auto-complete to
Congratulation! You just used auto-completion :-)
Auto-completion in Debian bash is a great tool. You type the first letters, press tab and the word is auto-completed.
Bash can call an executable binary to return the available words. So it can be written in Rust. This can produce even better results as known as
For my knowledge
cargo does not have auto-completion yet. There are many plans. It can take some time.
I will build what I need now. Something simple. It doesn't need to be perfect.
This is a great blog:
The Linux command
complete adds auto_completion definitions to bash.
But it is only for the current session. If you want to make it persistent add it to you
~/.bashrc file. Or to some other file that runs commands on initialization of the bash.
# list the definitions complete # delete a definition complete -r cargo # define a binary to auto-complete the command complete -C "binary" command
I choose this long name for my crate, because cargo-completion is a hot topic. Sooner or later someone will build it - officially. This is why I added the prefix
dev_bestia_, because my web domain is bestia.dev. This way I have the guarantee of a unique name and leave the short name to the future official version.
cargo install cargo-auto
and then list the user-defined automation tasks with
You can change the definition for bash auto-completion to point to the compilation of this project in development. So you can easy test the auto-completion while developing it.
complete -C "/home/luciano/rustprojects/dev_bestia_cargo_completion/target/debug/dev_bestia_cargo_completion" cargo
We leave in times of danger with
supply chain attacks.
It is recommended to always use cargo-crev
to verify the trustworthiness of each of your dependencies.
Please, spread this info.
You can also read reviews quickly on the web. Example for the crate
My open-source projects are free and free as a beer (MIT license).
I just love programming.
But I need also to drink. If you find my projects and tutorials helpful, please buy me a beer or two donating on my paypal. You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje !