August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this section, you will learn how to create aliases for existing commands with cobra.
As before, you will first need to create a new cobra project, which in this case is going to be called aliases, along with the desired commands. This can be done as follows:
$ ~/go/bin/cobra init aliases $ cd ~/go/src/aliases $ ~/go/bin/cobra add initialization initialization created at /Users/mtsouk/go/src/aliases/cmd/initialization.go $ ~/go/bin/cobra add preferences preferences created at /Users/mtsouk/go/src/aliases/cmd/preferences.go
So far, you have a command-line utility that supports two commands, named initialization and preferences.
Each alias of an existing cobra command needs to be explicitly specified in the Go code. ...
Read now
Unlock full access