Run executes the command logic
(f factory.Factory, cobraCmd *cobra.Command, args []string)
| 35 | |
| 36 | // Run executes the command logic |
| 37 | func (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 | } |
no test coverage detected