MCPcopy
hub / github.com/cloudfoundry/cli / CallCoreCommand

Method CallCoreCommand

plugin/rpc/cli_rpc_server.go:169–200  ·  view source on GitHub ↗
(args []string, retVal *bool)

Source from the content-addressed store, hash-verified

167}
168
169func (cmd *CliRpcCmd) CallCoreCommand(args []string, retVal *bool) error {
170 var err error
171 cmdRegistry := commandregistry.Commands
172
173 cmd.outputBucket = &bytes.Buffer{}
174 cmd.outputCapture.SetOutputBucket(cmd.outputBucket)
175
176 if cmdRegistry.CommandExists(args[0]) {
177 deps := commandregistry.NewDependency(cmd.stdout, cmd.logger, dialTimeout)
178
179 // set deps objs to be the one used by all other commands
180 // once all commands are converted, we can make fresh deps for each command run
181 deps.Config = cmd.cliConfig
182 deps.RepoLocator = cmd.repoLocator
183
184 // set command ui's TeePrinter to be the one used by RpcService, for output to be captured
185 deps.UI = terminal.NewUI(os.Stdin, cmd.stdout, cmd.outputCapture.(*terminal.TeePrinter), cmd.logger)
186
187 err = cmd.newCmdRunner.Command(args, deps, false)
188 } else {
189 *retVal = false
190 return nil
191 }
192
193 if err != nil {
194 *retVal = false
195 return err
196 }
197
198 *retVal = true
199 return nil
200}
201
202func (cmd *CliRpcCmd) GetOutputAndReset(args bool, retVal *[]string) error {
203 v := strings.TrimSuffix(cmd.outputBucket.String(), "\n")

Callers

nothing calls this directly

Calls 5

NewDependencyFunction · 0.92
NewUIFunction · 0.92
CommandExistsMethod · 0.80
SetOutputBucketMethod · 0.65
CommandMethod · 0.65

Tested by

no test coverage detected