func (cmd *RouterGroups) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { return []requirements.Requirement{ requirementsFactory.NewUsageRequirement(commandregistry.CLICommandUsagePresenter(cmd), T("No argument required"), func() bool { return len(fc.Args()) != 0 }, ), requirementsFactory.NewLoginRequirement(), requirementsFactory.NewRoutingAPIRequirement(), }, nil }
func (cmd *CreateSharedDomain) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. Requires DOMAIN as an argument\n\n") + commandregistry.Commands.CommandUsage("create-shared-domain")) return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1) } reqs := []requirements.Requirement{ requirementsFactory.NewLoginRequirement(), } if fc.String("router-group") != "" { reqs = append(reqs, []requirements.Requirement{ requirementsFactory.NewMinAPIVersionRequirement("Option '--router-group'", cf.RoutePathMinimumAPIVersion), requirementsFactory.NewRoutingAPIRequirement(), }...) } return reqs, nil }