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

Method HasCommand

command/common/command_list_v7.go:211–225  ·  view source on GitHub ↗

HasCommand returns true if the command name is in the command list.

(name string)

Source from the content-addressed store, hash-verified

209
210// HasCommand returns true if the command name is in the command list.
211func (c commandList) HasCommand(name string) bool {
212 if name == "" {
213 return false
214 }
215
216 cType := reflect.TypeOf(c)
217 _, found := cType.FieldByNameFunc(
218 func(fieldName string) bool {
219 field, _ := cType.FieldByName(fieldName)
220 return field.Tag.Get("command") == name
221 },
222 )
223
224 return found
225}
226
227// HasAlias returns true if the command alias is in the command list.
228func (c commandList) HasAlias(alias string) bool {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected