MCPcopy Index your code
hub / github.com/docker/cli / getPlugin

Function getPlugin

cli-plugins/manager/manager.go:105–123  ·  view source on GitHub ↗
(name string, pluginDirs []string, rootcmd *cobra.Command)

Source from the content-addressed store, hash-verified

103}
104
105func getPlugin(name string, pluginDirs []string, rootcmd *cobra.Command) (*Plugin, error) {
106 candidates := listPluginCandidates(pluginDirs)
107 if paths, ok := candidates[name]; ok {
108 if len(paths) == 0 {
109 return nil, errPluginNotFound(name)
110 }
111 c := &candidate{paths[0]}
112 p, err := newPlugin(c, rootcmd.Commands())
113 if err != nil {
114 return nil, err
115 }
116 if !errdefs.IsNotFound(p.Err) {
117 p.ShadowedPaths = paths[1:]
118 }
119 return &p, nil
120 }
121
122 return nil, errPluginNotFound(name)
123}
124
125// ListPlugins produces a list of the plugins available on the system
126func ListPlugins(dockerCli config.Provider, rootcmd *cobra.Command) ([]Plugin, error) {

Callers 2

invokeAndCollectHooksFunction · 0.85
GetPluginFunction · 0.85

Calls 3

listPluginCandidatesFunction · 0.85
errPluginNotFoundTypeAlias · 0.85
newPluginFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…