GOLANG: CLI

Building simple command-line (CLI) applications in Go using Commando

In this article, we are going to learn about the Commando package to create simple CLI applications with ease.

Uday Hiwarale
System Failure
Published in
13 min readApr 5, 2020

--

(source: unsplash.com)

Before I explain how Commando works and how to create a simple CLI application, I think it’s better if we understand some things about a CLI application and how I created the Commando library.

If you are not interested, you can skip this section.

I have been working with Commander.js to create CLI applications for quite some time now. It is widely popular in the Node.js community and it provides one of the best APIs to easily create CLI tools. But the drawback of using Node.js is that a person installing your CLI application needs to have Node.js installed in his/her system.

Go (Golang) on the other hand is compiled language, which means you can compile your program ahead-of-time and share the executable binary file. One does not need to have Go installed on his/her system to install your CLI application. One can just download and install this binary file.

Hence I was looking for a good library that provides an easy-to-use interface to create CLI applications. There are many good libraries out there and…

--

--