Programming from the Command Line
Overview
In this chapter, we will look at programming from the command line. We will see how Go is an excellent choice for creating powerful command-line utilities and applications, as well as discuss the many tools available for working with the command line using Go.
By reading this chapter, you will acquaint yourself with developing powerful command-line utilities and applications in Go. We will start with the basics of reading in command-line arguments and employing those flag values to control application behavior, take a peek at dealing with larger amounts of data inside and outside the application, and evaluate exit codes and best practices along the way. Then, we will dive a bit deeper and discuss strategies for gracefully handling interrupts, initiating external commands from our application, and using go install
. Finally, we will learn how to create terminal user interfaces (TUIs), which allow us to craft robust, user-friendly command...