(requirementsFactory requirements.Factory, fc flags.FlagContext)
| 61 | } |
| 62 | |
| 63 | func (cmd *MapRoute) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) { |
| 64 | if len(fc.Args()) != 2 { |
| 65 | cmd.ui.Failed(T("Incorrect Usage. Requires APP_NAME and DOMAIN as arguments\n\n") + commandregistry.Commands.CommandUsage("map-route")) |
| 66 | return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 2) |
| 67 | } |
| 68 | |
| 69 | if fc.IsSet("port") && (fc.IsSet("hostname") || fc.IsSet("path")) { |
| 70 | cmd.ui.Failed(T("Cannot specify port together with hostname and/or path.")) |
| 71 | return nil, fmt.Errorf("Cannot specify port together with hostname and/or path.") |
| 72 | } |
| 73 | |
| 74 | if fc.IsSet("random-port") && (fc.IsSet("port") || fc.IsSet("hostname") || fc.IsSet("path")) { |
| 75 | cmd.ui.Failed(T("Cannot specify random-port together with port, hostname and/or path.")) |
| 76 | return nil, fmt.Errorf("Cannot specify random-port together with port, hostname and/or path.") |
| 77 | } |
| 78 | |
| 79 | appName := fc.Args()[0] |
| 80 | domainName := fc.Args()[1] |
| 81 | |
| 82 | requirement := requirementsFactory.NewApplicationRequirement(appName) |
| 83 | cmd.appReq = requirement |
| 84 | |
| 85 | cmd.domainReq = requirementsFactory.NewDomainRequirement(domainName) |
| 86 | |
| 87 | var reqs []requirements.Requirement |
| 88 | |
| 89 | reqs = append(reqs, []requirements.Requirement{ |
| 90 | requirementsFactory.NewLoginRequirement(), |
| 91 | cmd.appReq, |
| 92 | cmd.domainReq, |
| 93 | }...) |
| 94 | |
| 95 | return reqs, nil |
| 96 | } |
| 97 | |
| 98 | func (cmd *MapRoute) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command { |
| 99 | cmd.ui = deps.UI |
nothing calls this directly
no test coverage detected