MCPcopy
hub / github.com/cloudfoundry/cli / displayOutdatedPlugins

Method displayOutdatedPlugins

command/plugin/plugins_command.go:62–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func (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
98func (cmd PluginsCommand) displayPluginCommands(plugins []configv3.Plugin) error {
99 cmd.UI.DisplayText("Listing installed plugins...")

Callers 1

ExecuteMethod · 0.95

Calls 7

PluginRepositoriesMethod · 0.65
DisplayTextWithFlavorMethod · 0.65
GetOutdatedPluginsMethod · 0.65
DisplayNewlineMethod · 0.65
DisplayTextMethod · 0.65
BinaryNameMethod · 0.65

Tested by

no test coverage detected