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

Function IsPluginCommand

util/plugin/plugin.go:30–48  ·  view source on GitHub ↗
(osArgs []string)

Source from the content-addressed store, hash-verified

28}
29
30func IsPluginCommand(osArgs []string) (configv3.Plugin, bool) {
31 if len(osArgs) < 1 {
32 return configv3.Plugin{}, false
33 }
34 command := osArgs[0]
35 config, configErr := configv3.LoadConfig()
36 if configErr != nil {
37 fmt.Fprintf(os.Stderr, "Empty Config, failed to load plugins")
38 return configv3.Plugin{}, false
39 }
40 for _, plugin := range config.Plugins() {
41 for _, pluginCommand := range plugin.Commands {
42 if command == pluginCommand.Name || command == pluginCommand.Alias {
43 return plugin, true
44 }
45 }
46 }
47 return configv3.Plugin{}, false
48}
49
50func PluginCommandNames() []string {
51 var names []string

Callers

nothing calls this directly

Calls 2

LoadConfigFunction · 0.92
PluginsMethod · 0.65

Tested by

no test coverage detected