MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Command

Method Command

plugin/rpc/call_command_registry.go:23–57  ·  view source on GitHub ↗
(args []string, deps commandregistry.Dependency, pluginApiCall bool)

Source from the content-addressed store, hash-verified

21}
22
23func (c *commandRunner) Command(args []string, deps commandregistry.Dependency, pluginApiCall bool) (err error) {
24 cmdRegistry := commandregistry.Commands
25
26 if cmdRegistry.CommandExists(args[0]) {
27 fc := flags.NewFlagContext(cmdRegistry.FindCommand(args[0]).MetaData().Flags)
28 err = fc.Parse(args[1:]...)
29 if err != nil {
30 return err
31 }
32
33 cfCmd := cmdRegistry.FindCommand(args[0])
34 cfCmd = cfCmd.SetDependency(deps, pluginApiCall)
35
36 reqs, reqErr := cfCmd.Requirements(requirements.NewFactory(deps.Config, deps.RepoLocator), fc)
37 if reqErr != nil {
38 return reqErr
39 }
40
41 for _, r := range reqs {
42 if err = r.Execute(); err != nil {
43 return err
44 }
45 }
46
47 defer func() {
48 if r := recover(); r != nil {
49 err = fmt.Errorf("command panic: %v", r)
50 }
51 }()
52
53 return cfCmd.Execute(fc)
54 }
55
56 return nil
57}

Callers

nothing calls this directly

Calls 9

ParseMethod · 0.95
NewFlagContextFunction · 0.92
NewFactoryFunction · 0.92
CommandExistsMethod · 0.80
FindCommandMethod · 0.80
MetaDataMethod · 0.65
SetDependencyMethod · 0.65
RequirementsMethod · 0.65
ExecuteMethod · 0.65

Tested by

no test coverage detected