INNER CODE UNIT · Go
main
google/go-containerregistry · cmd/gcrane/main.go:40
func main() {
options := []crane.Option{crane.WithAuthFromKeychain(gcrane.Keychain)}
// Same as crane, but override usage and keychain.
root := cmd.New(use, short, options)
// Add or override commands.
gcraneCmds := []*cobra.Command{gcmd.NewCmdList(), gcmd.NewCmdGc(), gcmd.NewCmdCopy(), cmd.NewCmdAuth(options, "gcrane", "auth")}
// Maintain a map of google-specific commands that we "override".
used := make(map[string]bool)
for _, cmd := range gcraneCmds {
used[cmd.Use] = true
}
// Remove those from crane's set of commands.
for _, cmd := range root.Commands() {
if _, ok := used[cmd.Use]; ok {
root.RemoveCommand(cmd)