MCPcopy
hub / github.com/helm/helm / run

Method run

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

Source from the content-addressed store, hash-verified

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

Callers 1

newPluginUninstallCmdFunction · 0.95

Calls 3

LoadAllDirFunction · 0.92
findPluginFunction · 0.85
uninstallPluginFunction · 0.85

Tested by

no test coverage detected