MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Run

Method Run

cmd/list/plugins.go:37–65  ·  view source on GitHub ↗

Run executes the command logic

(f factory.Factory, cobraCmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

35
36// Run executes the command logic
37func (cmd *pluginsCmd) Run(f factory.Factory, cobraCmd *cobra.Command, args []string) error {
38 plugins, err := f.NewPluginManager(f.GetLog()).List()
39 if err != nil {
40 return err
41 }
42
43 headerColumnNames := []string{
44 "Name",
45 "Version",
46 "Commands",
47 "Vars",
48 }
49
50 // Transform values into string arrays
51 rows := make([][]string, 0, len(plugins))
52 for _, plugin := range plugins {
53 row := []string{
54 plugin.Name,
55 plugin.Version,
56 strconv.Itoa(len(plugin.Commands)),
57 strconv.Itoa(len(plugin.Vars)),
58 }
59
60 rows = append(rows, row)
61 }
62
63 log.PrintTable(f.GetLog(), headerColumnNames, rows)
64 return nil
65}

Callers 1

newPluginsCmdFunction · 0.95

Calls 4

PrintTableFunction · 0.92
ListMethod · 0.65
NewPluginManagerMethod · 0.65
GetLogMethod · 0.65

Tested by

no test coverage detected