My Go CLI Tools

Working with the CLI is still one of the main modes of computation for me. My approach to scripts and tools on the command line has changed. Instead of writing complex ‘god’ shell scripts that try to cover all edge cases, I began to write a lot simpler scripts. Yes, they might not work in all situations, but reading and maintaining them is a lot easier for me.

Since working with Go is so comfortable to write, I started to write more and more CLI tools in it. I collect those tools in my belt repository on codeberg .

A couple of tools that are included currently:

├── hasenfetch
├── hex
├── jenv
├── jo
├── nibs
├── obs
├── pal
├── repo
├── serve
├── slow
├── ssl-expiry
├── timezone
├── urlencode
├── uuid
└── xls-format

I appreciate a lot of what Golang is doing, and some CLI tools are just thin CLI’s around a Go function. But Go is great for some more complex tools. Charm makes excellent libraries that I often use. Cobra is very useful when a tool grows to have more rich CLI options.

When writing a Go tool I still practice the approach that less code is better. I start with just a main.go and as the tool evolves I slowly refactor it into Cobra cmds or different files.

I also make extensive use of code agents to write and rewrite. Nonetheless, I like to think there is still a human touch in these tools. If anything, this is a great way to learn and improve.

I usually try my idea for a new tool and put it in my labs repo on codeberg . It then might graduate to belt if I use it for a while, and I get the impression of it being kind of well-rounded.

I can only recommend anyone to also create their own set of tools like this. It feels great to be able to add features when needed and there is a subjective boost to my capacity not only on the terminal but to my computing in general.