Adding the First Subcommand to the Application
Learn how to add the subcommand to our application by using the Cobra generator.
We'll cover the following...
After initializing the application, we use the Cobra generator to add subcommands to it. The generator includes a file in the cmd
directory for each subcommand. Each file includes boilerplate code for the subcommand. It also adds the subcommand to its parent, forming the tree-like structure.
Adding a subcommand
We add a new subcommand called hosts
to our application to ...