As presented in the last post, Nushell is a Rust different shell build for Linux systems, with a different proposal and much more functions compared to common shells, like zsh or bash.
After we packaged Nushell for Debian, we are now going to contribute directly to its repository, in a area that makes this shell so much different than other ones: its scripts.
Autocomplete scripts
Nushell has a repository only for scripts. We are going to focus on the custom-completion
folder.
I have a good experience with docker
, is a great ally to creating container, principally for testing software in a controlled environment, using Dockerfile
to make most of the process automatic. So, why not contribute to docker
commands completions, as we have many IDs for the containers and images we use, which are very hard to remember without issuing other command like docker ps -a
, etc.
Docker completion
Docker
has MANY commands, much more than I expected. Each command has subcommands and flags, that need to be shown in the autocompletion. To build the script, each command has to use a function, and each subcommand has another function. It keeps going exponentially.
The work wasn’t about thinking how to implement, but to write properly. The fact that I already known docker
made the process much easier. After checking basicaly all docker commands with “—help” flags, I’ve made it to a approximately 800 lines of completion script, which led me to a Pull Request.
Acception
As docker didn’t exist in the custom-completions
folder, it was relatively easy to merge. After a day, they accepted my Pull Request, and now I am officialy a Nu_scripts contributor.
I am very happy with my first acceptance in a open-source project that nobody knw me. They trusted and reviewed my work and now I can use it, as Nushell is present on my daily basis use.