Fig.io? It’s Easy If You Do It Smart

It’s not about autocomplete anymore. It’s about making your dev life easier!

Marta Basto
The Tech Collective
3 min readApr 3, 2023

--

Fig website screenshot
Screenshot by Author

As a graduate developer in a fast-growing company, I spend most of my time learning from others, asking questions and getting acquainted with tools that will help my productivity. Today, I want to talk about a great tool that all developers should use, especially those who are learning to code. Enter Fig.io!

Fig aims to make our life easier by adding features like autocomplete to our terminals, shells and IDEs. Not only that, but it also works really well with other tools, like git and docker! Overall, it makes my experience with the command line much quicker and smoother.

Now that you have fallen in love with Fig, let me tell you about its coolest feature, Scripts.

When it comes to version control and git, it is best practice to clean up outdated and unfinished branches. Of course, you can choose to delete branches once they are merged to ‘main’ when you create said branch, but it won’t be deleted on your local machine.

So, I created a script on Fig that takes care of this cleanup process for me…or rather, makes it harder for me to mess it up in the first place!

Before I spam this article with screenshots, have a look at the flow the script follows:

screenshot of terminal; shows a confirmation message that the selected local branch was deleted
Screenshot by Author

1- Starts by selecting one branch from the list of local branches.

2- Upon pressing enter, it will proceed and delete that branch from your local machine.

That’s it! Couldn’t be any simpler than that. I am looking into adding some sort of confirmation input to this script, purely to stop me from making a mistake and deleting the wrong branch by accident. But for now, this works for me!

For those interested in how was this script built, please see the screenshots below. From the Dashboard, go to Scripts & CLIs and you should be able to search for it, as I made the script public. But if you want to build it yourself or tweak it to fit your needs, you can press New Script and add as many “blocks” as you want. This one has an input block and a code block only.

Screenshot of Fig scripts; shows a box where you have fields like placeholder and Generators to create your input
Screenshot by Author

The input block is of type select, and you get some nice options with it, one of them being Generators. This is where you can bring commands such as git branch -a to display a list of your local branches, and many others, in a nicer way visually.

Screenshot of Fig scripts; shows a box where you can write a command in bash, such as, git branch -D followed by the name of the branch between double curlies
Screenshot by Author

The code block is bash because it’s a terminal command that needs to be triggered to delete a local branch.

There is so much more you can do with Fig.io, but scripts is by far my favourite part!

I’d love to hear your thoughts on Fig and how you implement it to your day-to-day workflow, so please add them in the comments and we can share ideas amongst ourselves.

--

--

Marta Basto
The Tech Collective

Software Developer @xDesign | Usually here to dump all-things-dev content that I have learned so far.