(requirementsFactory requirements.Factory, fc flags.FlagContext)
| 57 | } |
| 58 | |
| 59 | func (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 | |
| 86 | func (cmd *UnmapRoute) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command { |
| 87 | cmd.ui = deps.UI |
nothing calls this directly
no test coverage detected