(name string, pluginDirs []string, rootcmd *cobra.Command)
| 103 | } |
| 104 | |
| 105 | func 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 |
| 126 | func ListPlugins(dockerCli config.Provider, rootcmd *cobra.Command) ([]Plugin, error) { |
no test coverage detected
searching dependent graphs…