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

Method Requirements

cf/commands/application/ssh.go:64–87  ·  view source on GitHub ↗
(requirementsFactory requirements.Factory, fc flags.FlagContext)

Source from the content-addressed store, hash-verified

62}
63
64func (cmd *SSH) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) ([]requirements.Requirement, error) {
65 if len(fc.Args()) != 1 {
66 cmd.ui.Failed(T("Incorrect Usage. Requires APP_NAME as argument") + "\n\n" + commandregistry.Commands.CommandUsage("ssh"))
67 return nil, fmt.Errorf("Incorrect usage: %d arguments of %d required", len(fc.Args()), 1)
68 }
69
70 var err error
71 cmd.opts, err = options.NewSSHOptions(fc)
72
73 if err != nil {
74 cmd.ui.Failed(fmt.Sprintf(T("Incorrect Usage:")+" %s\n\n%s", err.Error(), commandregistry.Commands.CommandUsage("ssh")))
75 return nil, err
76 }
77
78 cmd.appReq = requirementsFactory.NewApplicationRequirement(cmd.opts.AppName)
79
80 reqs := []requirements.Requirement{
81 requirementsFactory.NewLoginRequirement(),
82 requirementsFactory.NewTargetedSpaceRequirement(),
83 cmd.appReq,
84 }
85
86 return reqs, nil
87}
88
89func (cmd *SSH) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command {
90 cmd.ui = deps.UI

Callers

nothing calls this directly

Calls 8

NewSSHOptionsFunction · 0.92
CommandUsageMethod · 0.80
ArgsMethod · 0.65
FailedMethod · 0.65
ErrorMethod · 0.65
NewLoginRequirementMethod · 0.65

Tested by

no test coverage detected