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

Function newPluginListCmd

pkg/cmd/plugin_list.go:32–77  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

30)
31
32func newPluginListCmd(out io.Writer) *cobra.Command {
33 var pluginType string
34 cmd := &cobra.Command{
35 Use: "list",
36 Aliases: []string{"ls"},
37 Short: "list installed Helm plugins",
38 ValidArgsFunction: noMoreArgsCompFunc,
39 RunE: func(_ *cobra.Command, _ []string) error {
40 slog.Debug("pluginDirs", "directory", settings.PluginsDirectory)
41 dirs := filepath.SplitList(settings.PluginsDirectory)
42 descriptor := plugin.Descriptor{
43 Type: pluginType,
44 }
45 plugins, err := plugin.FindPlugins(dirs, descriptor)
46 if err != nil {
47 return err
48 }
49
50 // Get signing info for all plugins
51 signingInfo := plugin.GetSigningInfoForPlugins(plugins)
52
53 table := uitable.New()
54 table.AddRow("NAME", "VERSION", "TYPE", "APIVERSION", "PROVENANCE", "SOURCE")
55 for _, p := range plugins {
56 m := p.Metadata()
57 sourceURL := m.SourceURL
58 if sourceURL == "" {
59 sourceURL = "unknown"
60 }
61 // Get signing status
62 signedStatus := "unknown"
63 if info, ok := signingInfo[m.Name]; ok {
64 signedStatus = info.Status
65 }
66 table.AddRow(m.Name, m.Version, m.Type, m.APIVersion, signedStatus, sourceURL)
67 }
68 fmt.Fprintln(out, table)
69 return nil
70 },
71 }
72
73 f := cmd.Flags()
74 f.StringVar(&pluginType, "type", "", "Plugin type")
75
76 return cmd
77}
78
79// Returns all plugins from plugins, except those with names matching ignoredPluginNames
80func filterPlugins(plugins []plugin.Plugin, ignoredPluginNames []string) []plugin.Plugin {

Callers 1

newPluginCmdFunction · 0.85

Calls 3

FindPluginsFunction · 0.92
GetSigningInfoForPluginsFunction · 0.92
MetadataMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…