Table output functions
(plugins map[string]*plugins.LoadedPlugin)
| 359 | |
| 360 | // Table output functions |
| 361 | func pluginListTableOutput(plugins map[string]*plugins.LoadedPlugin) { |
| 362 | if len(plugins) == 0 { |
| 363 | fmt.Println("No plugins installed") |
| 364 | return |
| 365 | } |
| 366 | |
| 367 | t := output.NewTableWriter() |
| 368 | t.AppendHeader(table.Row{"Name", "Version", "Description", "Commands"}) |
| 369 | |
| 370 | for name, plugin := range plugins { |
| 371 | commandStr := fmt.Sprintf("%d command(s)", len(plugin.Metadata.Commands)) |
| 372 | if len(plugin.Metadata.Commands) == 0 { |
| 373 | commandStr = "no commands" |
| 374 | } |
| 375 | |
| 376 | t.AppendRow(table.Row{name, plugin.Metadata.Version, plugin.Metadata.Description, commandStr}) |
| 377 | t.AppendSeparator() |
| 378 | } |
| 379 | |
| 380 | t.Render() |
| 381 | } |
| 382 | |
| 383 | func pluginInfoTableOutput(plugin *plugins.LoadedPlugin) { |
| 384 | t := output.NewTableWriter() |
no test coverage detected