()
| 60 | } |
| 61 | |
| 62 | func (cmd PluginsCommand) displayOutdatedPlugins() error { |
| 63 | repos := cmd.Config.PluginRepositories() |
| 64 | if len(repos) == 0 { |
| 65 | return translatableerror.NoPluginRepositoriesError{} |
| 66 | } |
| 67 | repoNames := make([]string, len(repos)) |
| 68 | for i := range repos { |
| 69 | repoNames[i] = repos[i].Name |
| 70 | } |
| 71 | cmd.UI.DisplayTextWithFlavor("Searching {{.RepoNames}} for newer versions of installed plugins...", |
| 72 | map[string]interface{}{ |
| 73 | "RepoNames": strings.Join(repoNames, ", "), |
| 74 | }) |
| 75 | |
| 76 | outdatedPlugins, err := cmd.Actor.GetOutdatedPlugins() |
| 77 | if err != nil { |
| 78 | return err |
| 79 | } |
| 80 | |
| 81 | table := [][]string{{"plugin", "version", "latest version"}} |
| 82 | |
| 83 | for _, plugin := range outdatedPlugins { |
| 84 | table = append(table, []string{plugin.Name, plugin.CurrentVersion, plugin.LatestVersion}) |
| 85 | } |
| 86 | |
| 87 | cmd.UI.DisplayNewline() |
| 88 | cmd.UI.DisplayTableWithHeader("", table, ui.DefaultTableSpacePadding) |
| 89 | |
| 90 | cmd.UI.DisplayNewline() |
| 91 | cmd.UI.DisplayText("Use '{{.BinaryName}} install-plugin' to update a plugin to the latest version.", map[string]interface{}{ |
| 92 | "BinaryName": cmd.Config.BinaryName(), |
| 93 | }) |
| 94 | |
| 95 | return nil |
| 96 | } |
| 97 | |
| 98 | func (cmd PluginsCommand) displayPluginCommands(plugins []configv3.Plugin) error { |
| 99 | cmd.UI.DisplayText("Listing installed plugins...") |
no test coverage detected