MCPcopy Create free account
hub / github.com/cloudfoundry/cli / Requirements

Method Requirements

cf/commands/route/unmap_route.go:59–84  ·  view source on GitHub ↗
(requirementsFactory requirements.Factory, fc flags.FlagContext)

Source from the content-addressed store, hash-verified

57}
58
59func (cmd *UnmapRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
60 if len(fc.Args()) != 2 {
61 cmd.ui.Failed(T("Incorrect Usage. Requires app_name, domain_name as arguments\n\n") + commandregistry.Commands.CommandUsage("unmap-route"))
62 return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2)
63 }
64
65 if fc.IsSet("port") && (fc.IsSet("hostname") || fc.IsSet("path")) {
66 cmd.ui.Failed(T("Cannot specify port together with hostname and/or path."))
67 return nil, fmt.Errorf("Cannot specify port together with hostname and/or path.")
68 }
69
70 domainName := fc.Args()[1]
71
72 cmd.appReq = requirementsFactory.NewApplicationRequirement(fc.Args()[0])
73 cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName)
74
75 var reqs []requirements.Requirement
76
77 reqs = append(reqs, []requirements.Requirement{
78 requirementsFactory.NewLoginRequirement(),
79 cmd.appReq,
80 cmd.domainReq,
81 }...)
82
83 return reqs, nil
84}
85
86func (cmd *UnmapRoute) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command {
87 cmd.ui = deps.UI

Callers

nothing calls this directly

Calls 7

CommandUsageMethod · 0.80
ArgsMethod · 0.65
FailedMethod · 0.65
IsSetMethod · 0.65
NewDomainRequirementMethod · 0.65
NewLoginRequirementMethod · 0.65

Tested by

no test coverage detected