MCPcopy Create free account
hub / github.com/cloudfoundry/multiapps-cli-plugin / Execute

Method Execute

commands/base_command.go:95–124  ·  view source on GitHub ↗

Execute executes the command

(args []string)

Source from the content-addressed store, hash-verified

93
94// Execute executes the command
95func (c *BaseCommand) Execute(args []string) ExecutionStatus {
96 log.Tracef("Executing command '"+c.name+"': args: '%v'\n", args)
97
98 flags := flag.NewFlagSet(c.name, flag.ContinueOnError)
99 flags.SetOutput(io.Discard)
100
101 flags.String(deployServiceURLOpt, "", "")
102 c.defineCommandOptions(flags)
103
104 parser := NewCommandFlagsParser(flags, c.flagsParser, c.flagsValidator)
105 err := parser.Parse(args)
106 if err != nil {
107 c.Usage(err.Error())
108 return Failure
109 }
110
111 deployServiceUrl, err := c.deployServiceURLCalculator.ComputeDeployServiceURL(GetStringOpt(deployServiceURLOpt, flags))
112 if err != nil {
113 ui.Failed(err.Error())
114 return Failure
115 }
116
117 cfTarget, err := c.GetCFTarget()
118 if err != nil {
119 ui.Failed(err.Error())
120 return Failure
121 }
122
123 return c.executeInternal(parser.Args(), deployServiceUrl, flags, cfTarget)
124}
125
126// GetBoolOpt gets the option identified by the specified name.
127func GetBoolOpt(name string, flags *flag.FlagSet) bool {

Callers

nothing calls this directly

Calls 13

ParseMethod · 0.95
UsageMethod · 0.95
GetCFTargetMethod · 0.95
ArgsMethod · 0.95
TracefFunction · 0.92
FailedFunction · 0.92
NewCommandFlagsParserFunction · 0.85
GetStringOptFunction · 0.85
StringMethod · 0.80
defineCommandOptionsMethod · 0.65
executeInternalMethod · 0.65

Tested by

no test coverage detected