DEV Community

Cover image for Master any CLI tool with this one weird trick
Batuhan Ipci
Batuhan Ipci

Posted on

Master any CLI tool with this one weird trick

Just like most developers, I live in the terminal, I savor the ability of automation and the boundless things I can do with it.

Before I start, I want to briefly remark on my setup;

My setup 👽

I used to use bash and know the best as my default shell, but I solely switched to zsh because it become the default in macOS, likewise I use ohmyzsh as my framework. It is a pleasant experience and easy to manage the prompt and plugins.

I recently heard about prezto which is a fork of ohmyzsh but haven't tried it yet (most of the plugins I use are in ohmyzsh) it is more customizable and less bloated than ohmyzsh.

I use iTerm2 as my terminal, it is a great alternative to the default macOS terminal and has a lot of features - customization.

Writing completion spec 📝

Recently I have contributed to Fig
Specifically to their autocomplete feature withfig/autocomplete which is an open-source project that aims to provide auto-completion for CLI tools.

This is a preview of the autocomplete feature in Fig, the tool taplo is what I wrote the completion spec for.


How it works ❓

While it required some brainstorming and a bit of research, it was a smooth experience to contribute to this project, and I learned a lot. First, I followed their documentation on writing a completion spec, which is well written, and learned a lot about the basic CLI terminology (i.e. command, subcommand, option, argument). Corresponding to what tool you choose to write the completion spec for, you need to learn a bit about the tool itself, which is cool because you get to know the tool better.

I tackled the issue missing spec for taplo #1532.


Taplo is a CLI tool for working with TOML files, and it includes features like linting, formatting, and validation. I honestly didn't know much about TOML before I started working on this, but I learned a lot about both the tool and TOML itself.

Some CLI tools have man pages and in such situations like writing completion spec, people usually use them as a source to learn about the tool and its subcommands options, etc. (Usually they have the best reputation for being the most accurate source of information). Though, the tool I chose to write the completion spec, taplo, did not have any manual entry pages. Even better! I found their website and documentation which was really helpful.

Takeaways 💯

Maintainers of withfig/autocomplete are super active and helpful. They constantly add more issues related to writing brand-new completion specs and improving existing ones. Writing completion specs, I think, is one of the best gateways to learning about CLI tools in depth and contributing to open-source. Also, if you are using Fig you can actually use the completion specs you wrote in your terminal!

Top comments (7)

jihedkdiss profile image
Jihed Kdiss

This article highlights a very important learning strategy:


In other terms, sitting out there watching endless video tutorials or reading books without getting your hands dirty is just useless.

The moment you start writing code and fixing bugs is the moment you start learning.

Good job Batuhan, Keep going!

batunpc profile image
Batuhan Ipci

Thank you Jihed for reading!

saminarp profile image
Samina Rahman Purba

Wooo! 🎊🎊🎉

rescenic profile image
Muhammad Ridwan Hakim

Windows please

corysus profile image

It's great but most of the time autocomplete doesn't work, also sometimes consume a lot of memory :(

fire17 profile image

awww yeaaa , when will this be available in linux do you reckon ?

Some comments may only be visible to logged-in visitors. Sign in to view all comments.