MCPcopy Index your code
hub / github.com/helm/helm / run

Method run

pkg/cmd/plugin_update.go:63–86  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

61}
62
63func (o *pluginUpdateOptions) run(out io.Writer) error {
64 slog.Debug("loading installed plugins", "path", settings.PluginsDirectory)
65 plugins, err := plugin.LoadAllDir(settings.PluginsDirectory, plugin.LogIgnorePluginLoadErrorFilterFunc)
66 if err != nil {
67 return err
68 }
69 var errorPlugins []error
70
71 for _, name := range o.names {
72 if found := findPlugin(plugins, name); found != nil {
73 if err := updatePlugin(found); err != nil {
74 errorPlugins = append(errorPlugins, fmt.Errorf("failed to update plugin %s, got error (%v)", name, err))
75 } else {
76 fmt.Fprintf(out, "Updated plugin: %s\n", name)
77 }
78 } else {
79 errorPlugins = append(errorPlugins, fmt.Errorf("plugin: %s not found", name))
80 }
81 }
82 if len(errorPlugins) > 0 {
83 return errors.Join(errorPlugins...)
84 }
85 return nil
86}
87
88func updatePlugin(p plugin.Plugin) error {
89 exactLocation, err := filepath.EvalSymlinks(p.Dir())

Callers 1

newPluginUpdateCmdFunction · 0.95

Calls 3

LoadAllDirFunction · 0.92
findPluginFunction · 0.85
updatePluginFunction · 0.85

Tested by

no test coverage detected