func (cmd *Authenticate) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 2 { cmd.ui.Failed(T("Incorrect Usage. Requires 'username password' as arguments\n\n") + commandregistry.Commands.CommandUsage("auth")) return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2) } reqs := []requirements.Requirement{ requirementsFactory.NewAPIEndpointRequirement(), } return reqs, nil }
func (cmd *Curl) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { if len(fc.Args()) != 1 { cmd.ui.Failed(T("Incorrect Usage. An argument is missing or not correctly enclosed.\n\n") + commandregistry.Commands.CommandUsage("curl")) return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1) } reqs := []requirements.Requirement{ requirementsFactory.NewAPIEndpointRequirement(), } return reqs, nil }
func (cmd *MarketplaceServices) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { usageReq := requirements.NewUsageRequirement(commandregistry.CLICommandUsagePresenter(cmd), T("No argument required"), func() bool { return len(fc.Args()) != 0 }, ) reqs := []requirements.Requirement{ usageReq, requirementsFactory.NewAPIEndpointRequirement(), } return reqs, nil }
func (cmd *Target) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { usageReq := requirements.NewUsageRequirement(commandregistry.CLICommandUsagePresenter(cmd), T("No argument required"), func() bool { return len(fc.Args()) != 0 }, ) reqs := []requirements.Requirement{ usageReq, requirementsFactory.NewAPIEndpointRequirement(), } if fc.IsSet("o") || fc.IsSet("s") { reqs = append(reqs, requirementsFactory.NewLoginRequirement()) } return reqs, nil }