func CreateCommand()

in tools/mig-scaler/main.go [156:178]


func CreateCommand(cfg *Config) (Command, error) {
	name := cfg.Command
	if cfg.Help {
		// If the help flag has been set, show the help instead, but do not
		// change the command so that the help can use it for the topic.
		name = "help"
	}

	switch name {
	case "":
		return nil, errors.New("command not specified")
	case "list":
		return NewList(cfg)
	case "scale":
		return NewScale(cfg)
	case "cancel":
		return NewCancel(cfg)
	case "help":
		return NewHelp(cfg), nil
	default:
		return nil, fmt.Errorf("unknown command: \"%s\"", name)
	}
}