Summary
In this chapter, we studied various methodologies of programming via the command line. We uncovered how Go is an excellent choice for creating command-line applications with ease, as well as how to use the native Go toolchain.
Starting with the os
and flag
packages, we looked at how to read arguments from the command line for our application. Then, we looked at flags to control the behavior of our program and looked at how streaming large amounts of data in and out of an application can shed light on how command-line applications in Go can be part of a bigger programmatic pipeline.
We also took a peak at handling the CLI shutdown process gracefully by discussing exit codes and interrupts, as well as invoking other commands from within our command-line application. We ended this chapter by looking at terminal UIs, taking our CLI to the next level, and installing other CLIs using the native Go toolchain.
In the next chapter, we will look at files and systems using Go...