Implementing a terminal dashboard
When creating a terminal dashboard, you can create it as a separate standalone application or as a command that is called from the command-line application. In our specific example for the player terminal dashboard, we are going to call the dashboard when the ./bin/audiofile player
command is called.
First, from the audio file’s root repository, we’ll need to use cobra-cli
to create the command:
cobra-cli add player Player created at /Users/mmontagnino/Code/src/github.com/marianina8/audiofile
Now, we can create the code to generate the terminal dashboard, called within the Run
field of the player
command. Remember that the terminal dashboard consists of four main layers: the terminal, infrastructure, container, and widgets. Like a painting, we’ll start with the base layer: the terminal.
Creating the terminal layer
The first thing you need to do is to create a terminal that provides access to any input and output...