Crate dev_bestia_cargo_completion_lib

source ·
Expand description

§dev_bestia_cargo_completion

Auto-completion for cargo-auto and automation_tasks_rs and partial auto-completion for cargo in bash
version: 2024.421.1905 date: 2024-04-21 author: bestia.dev repository: GitHub

maintained ready-for-use rustlang automation workflow

logo dev_bestia_cargo_completion is part of the automation_tasks_rs project

crates.io Documentation crev reviews Lib.rs
Licence Rust Newest docs dev_bestia_cargo_completion

Lines in Rust code Lines in Doc comments Lines in Comments Lines in examples Lines in tests

Hashtags: #maintained #ready-for-use #rustlang #automation #workflow
My projects on GitHub are more like a tutorial than a finished product: bestia-dev tutorials.
I recommend using the CRUSTDE - Containerized Rust Development Environment to write Rust projects on Linux, isolated from your system.

§Try it

Install the binary:

cargo install dev_bestia_cargo_completion

Save definition for auto_completion in bash:

complete -C "dev_bestia_cargo_completion" cargo

Start typing cargo b and press tab.
It should auto-complete to cargo build.
Congratulation! You just used auto-completion :-)

§bash 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 dynamic auto-completion.
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:
https://www.joshmcguigan.com/blog/shell-completions-pure-rust/

§complete, the Linux command

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 the ~/.bashrc file.

# list the definitions
complete
# delete a definition
complete -r cargo
# define a binary to auto-complete the command
complete -C "binary" command
# for example
complete -C "dev_bestia_cargo_completion" cargo

§Development details

Read the development details in a separate md file:
DEVELOPMENT.md

§Releases changelog

Read the changelog in a separate md file:
RELEASES.md

§TODO

Nothing big in the near future.

§Open-source and free as a beer

My open-source projects are 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 by donating to 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! Alla salute! Prost! Nazdravlje! 🍻

//bestia.dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials

Functions§

  • words after cargo auto execute the appropriate binary, that responds with println 1st argument in “completion” 2rd argument is the word_being_completed 3nd argument is the last_word
  • words after cargo auto execute the appropriate binary, that responds with println 1st argument in “completion” 2rd argument is the word_being_completed 3nd argument is the last_word
  • partial completion of the cargo build command first word after cargo build
  • partial completion of the cargo command first word after cargo